This commit is contained in:
Zengtudor 2025-08-05 10:27:13 +08:00
parent 1d13c6384a
commit 41bcad6b48
7 changed files with 185 additions and 0 deletions

32
src/8/5/805chess.cpp Normal file
View File

@ -0,0 +1,32 @@
#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <istream>
#include <limits>
using ll = int64_t;
int main(){
std::iostream::sync_with_stdio(false);
// freopen("chess.in", "r", stdin);
// freopen("chess.out", "w", stdout);
ll t;
std::cin>>t;
while(t--){
ll n,m,sx,sy,tx,ty;
std::cin>>n>>m>>sx>>sy>>tx>>ty;
ll ans=std::numeric_limits<ll>::max();
for(ll i=-1;i<=1;i++){
for(ll j=-1;j<=1;j++){
ll nx=tx+n*i;
ll ny=ty+m*j;
ll ansx=abs(nx-sx);
ll ansy=abs(ny-sy);
ans=std::min(ans,std::max(ansx,ansy));
}
}
std::cout<<ans<<'\n';
}
}

5
src/8/5/chess1.ans Normal file
View File

@ -0,0 +1,5 @@
1
4
2
4
1

6
src/8/5/chess1.in Normal file
View File

@ -0,0 +1,6 @@
5
9 1 0 0 1 0
8 8 5 7 1 1
3 6 2 4 0 0
6 9 1 0 1 4
6 3 3 1 4 0

20
src/8/5/chess2.ans Normal file
View File

@ -0,0 +1,20 @@
0
6
2
5
7
2
1
2
6
1
2
5
4
9
3
5
6
3
3
6

21
src/8/5/chess2.in Normal file
View File

@ -0,0 +1,21 @@
20
8 3 1 1 1 1
17 19 1 13 12 9
8 5 7 0 1 4
18 16 15 5 15 0
20 15 13 2 6 13
10 15 1 9 0 7
5 17 1 9 1 10
5 2 2 0 0 0
3 12 2 1 0 7
14 6 10 2 10 3
4 7 1 5 3 4
15 14 5 11 0 1
16 17 0 14 2 1
16 19 7 12 1 2
17 3 12 0 15 2
2 16 0 10 0 15
6 17 2 16 4 10
18 9 17 0 2 0
18 14 1 4 4 4
13 9 9 6 2 0

50
src/8/5/chess3.ans Normal file
View File

@ -0,0 +1,50 @@
385
140
229
47
264
71
111
279
121
251
56
88
77
29
16
194
92
86
280
220
105
139
481
162
28
98
253
428
61
130
311
6
200
218
160
157
22
292
146
209
258
56
297
310
230
154
137
222
290
437

51
src/8/5/chess3.in Normal file
View File

@ -0,0 +1,51 @@
50
868 754 780 358 395 441
906 399 426 269 286 308
67 972 43 669 43 898
102 94 88 39 27 86
790 708 586 258 322 85
937 748 100 459 29 485
840 456 439 332 328 288
776 594 546 103 692 382
433 293 207 96 328 36
198 829 39 154 98 732
741 272 203 196 178 140
920 445 341 169 429 249
140 156 85 111 71 34
128 936 60 64 85 35
273 89 167 82 176 9
516 46 292 32 98 38
140 714 76 680 44 58
222 460 113 10 131 384
523 844 481 88 383 368
668 235 529 215 309 137
699 67 70 43 664 27
128 369 92 269 11 39
649 967 484 377 269 863
183 549 30 15 9 402
38 233 26 209 34 181
35 708 9 35 14 645
44 633 37 115 37 368
923 825 102 450 597 121
20 161 16 123 6 62
304 439 209 183 35 75
545 984 542 29 101 340
297 871 129 743 123 745
677 818 261 218 234 18
886 878 541 702 393 484
33 773 24 224 24 384
773 374 585 348 428 101
135 12 7 6 120 4
186 634 117 69 148 411
522 118 208 37 62 111
505 12 435 2 226 0
65 758 60 483 63 741
620 433 481 126 425 144
362 963 217 207 27 504
682 146 116 83 426 114
515 942 233 670 3 445
300 627 56 197 224 351
905 73 733 55 870 32
752 717 520 609 638 387
980 4 226 2 916 3
896 294 610 191 173 289