QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#233471 | #2699. Gravity Grid | Fyind# | AC ✓ | 46ms | 33636kb | C++23 | 2.2kb | 2023-10-31 18:08:12 | 2023-10-31 18:08:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int)x.size())
const int maxn = 250000 + 5;
#define _ <<" " <<
int n, m, k;
struct DSU {
vector<int> fa, s;
int cnt; // connect area number
DSU(int n=1) : fa(n+1,-1), s(n+1,1), cnt(n) {}
int size(int x) { return s[find(x)]; }
int find(int x) { return -1 == fa[x] ? x : fa[x] = find(fa[x]); }
bool connect(int x, int y) {
x = find(x), y = find(y);
if (x == y) return false;
if (s[x] > s[y]) swap(x, y);
cnt--; s[y] += s[x];
fa[x] = y;
return true;
}
};
DSU dsux, dsuy, dsuxpy, dsuxmy;
int getid(int x,int y) {
return (y-1)*n + x;
}
vector<int> h[maxn];
bool hasb(int x,int y, int player) {
if (x < 1 || x > n || y < 1 || y > m) return false;
return h[x].size() >= y && h[x][y-1] % 2 == player;
}
void connect(int x,int y,int player,int tim) {
int id = getid(x,y);
if (hasb(x+1,y,player)) dsux.connect(id, getid(x+1,y));
if (hasb(x-1,y,player)) dsux.connect(id, getid(x-1,y));
if (hasb(x,y-1,player)) dsuy.connect(id, getid(x,y-1));
if (hasb(x-1,y-1,player)) dsuxpy.connect(id, getid(x-1,y-1));
if (hasb(x+1,y+1,player)) dsuxpy.connect(id, getid(x+1,y+1));
if (hasb(x+1,y-1,player)) dsuxmy.connect(id, getid(x+1,y-1));
if (hasb(x-1,y+1,player)) dsuxmy.connect(id, getid(x-1,y+1));
// cout << x _ y _ dsuxmy.size(id) << endl;
if (dsux.size(id) >= k || dsuy.size(id) >= k ||
dsuxmy.size(id) >= k || dsuxpy.size(id) >= k) {
if (player) {
cout << "A" _ tim << '\n';
exit(0);
} else {
cout << "B" _ tim << '\n';
exit(0);
}
}
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> m >> n >> k;
dsux = DSU(getid(n+1,m+1)); dsuy = DSU(getid(n+1,m+1));
dsuxpy = DSU(getid(n+1,m+1)); dsuxmy = DSU(getid(n+1,m+1));
vector<int> q(n*m+1);
for (int i = 1;i <= n*m; ++i) cin >> q[i];
for (int i = 1;i <= n*m; ++i) {
int c = q[i];
h[c].push_back(i&1);
connect(c, sz(h[c]), i&1, i);
}
cout << "D" << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 9744kb
input:
1 1 1 1
output:
A 1
result:
ok single line: 'A 1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 9708kb
input:
1 14 7 1 8 3 9 5 10 7 11 2 12 6 13 4 14
output:
A 13
result:
ok single line: 'A 13'
Test #3:
score: 0
Accepted
time: 1ms
memory: 9444kb
input:
1 14 7 4 11 3 12 5 10 2 13 6 9 1 14 7 8
output:
A 13
result:
ok single line: 'A 13'
Test #4:
score: 0
Accepted
time: 13ms
memory: 19008kb
input:
500 500 500 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...
output:
A 249999
result:
ok single line: 'A 249999'
Test #5:
score: 0
Accepted
time: 18ms
memory: 18760kb
input:
500 500 251 1 500 2 499 3 498 4 497 5 496 6 495 7 494 8 493 9 492 10 491 11 490 12 489 13 488 14 487 15 486 16 485 17 484 18 483 19 482 20 481 21 480 22 479 23 478 24 477 25 476 26 475 27 474 28 473 29 472 30 471 31 470 32 469 33 468 34 467 35 466 36 465 37 464 38 463 39 462 40 461 41 460 42 459 43 ...
output:
D
result:
ok single line: 'D'
Test #6:
score: 0
Accepted
time: 19ms
memory: 19092kb
input:
500 500 500 1 500 2 499 3 498 4 497 5 496 6 495 7 494 8 493 9 492 10 491 11 490 12 489 13 488 14 487 15 486 16 485 17 484 18 483 19 482 20 481 21 480 22 479 23 478 24 477 25 476 26 475 27 474 28 473 29 472 30 471 31 470 32 469 33 468 34 467 35 466 36 465 37 464 38 463 39 462 40 461 41 460 42 459 43 ...
output:
A 249501
result:
ok single line: 'A 249501'
Test #7:
score: 0
Accepted
time: 16ms
memory: 25868kb
input:
2 125000 125000 1 125000 2 124999 3 124998 4 124997 5 124996 6 124995 7 124994 8 124993 9 124992 10 124991 11 124990 12 124989 13 124988 14 124987 15 124986 16 124985 17 124984 18 124983 19 124982 20 124981 21 124980 22 124979 23 124978 24 124977 25 124976 26 124975 27 124974 28 124973 29 124972 30 ...
output:
D
result:
ok single line: 'D'
Test #8:
score: 0
Accepted
time: 17ms
memory: 19096kb
input:
125000 2 125000 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...
output:
A 249999
result:
ok single line: 'A 249999'
Test #9:
score: 0
Accepted
time: 38ms
memory: 33352kb
input:
1 250000 41666 22995 167189 2215 184589 47227 222882 7906 198312 97056 243669 112562 212033 66069 235467 43153 190850 67364 127841 23414 231832 73087 164203 68731 149400 115379 160997 98702 249085 75122 218626 4811 224630 31296 192500 116070 223953 6844 216987 28148 228594 6483 137856 73314 125280 4...
output:
A 249971
result:
ok single line: 'A 249971'
Test #10:
score: 0
Accepted
time: 2ms
memory: 9448kb
input:
4 3 2 1 1 2 3 3 2 2 1 1 2 3 3
output:
A 3
result:
ok single line: 'A 3'
Test #11:
score: 0
Accepted
time: 46ms
memory: 33296kb
input:
1 250000 41666 45582 232682 676 221447 85696 206626 64011 217439 58829 125284 78456 213084 90737 231291 65150 178939 120392 226289 8018 236632 113860 125262 87862 201262 124336 247735 97697 187396 56964 151828 88401 165081 90231 196181 115618 241670 48383 135303 2826 239059 28349 243215 122744 18845...
output:
B 249988
result:
ok single line: 'B 249988'
Test #12:
score: 0
Accepted
time: 39ms
memory: 33392kb
input:
1 250000 41666 80395 136722 72522 163457 36138 235104 106228 160951 78378 240076 88778 246608 90530 182957 67113 149460 11899 125838 18731 204039 107577 226765 83442 209708 41460 247539 23702 128627 66850 247368 96089 134953 96379 203222 89615 234882 115125 143066 89996 184023 22397 161842 51883 149...
output:
A 249989
result:
ok single line: 'A 249989'
Test #13:
score: 0
Accepted
time: 38ms
memory: 33636kb
input:
1 250000 41666 86413 234582 65021 196490 43308 140151 51475 144825 64072 127528 63561 225554 49748 226117 47761 232880 8511 244197 70787 192903 112739 223950 12515 204723 9155 185231 98796 178450 32697 226799 16732 227022 32270 231533 24235 175675 19372 248612 122149 233937 7301 143768 37864 203394 ...
output:
B 249986
result:
ok single line: 'B 249986'
Test #14:
score: 0
Accepted
time: 33ms
memory: 33604kb
input:
1 250000 41666 119710 189435 101362 184679 100307 246399 16951 182017 103843 248436 42633 148730 101709 147667 70841 197739 64320 227642 24337 132085 20711 249466 96630 132908 33033 185449 117338 211778 1757 218227 36231 185467 110127 206656 62723 177622 64776 245998 20078 212948 74169 150097 42901 ...
output:
B 249986
result:
ok single line: 'B 249986'
Test #15:
score: 0
Accepted
time: 14ms
memory: 18480kb
input:
504 488 263 108 235 58 235 346 55 365 91 1 116 238 370 133 35 113 323 322 138 270 462 325 173 390 343 72 3 427 211 440 374 414 89 214 261 237 429 36 109 467 145 125 385 317 215 231 1 447 347 33 175 268 166 8 235 386 474 479 34 427 488 167 429 350 411 312 184 62 337 365 324 192 26 136 484 445 238 295...
output:
B 69460
result:
ok single line: 'B 69460'
Test #16:
score: 0
Accepted
time: 15ms
memory: 15960kb
input:
400 453 249 449 92 33 453 213 62 202 427 211 50 183 372 352 165 387 124 165 115 310 256 185 141 442 355 328 278 303 317 112 314 54 313 149 205 191 233 219 314 241 52 54 288 224 103 429 282 439 205 446 231 343 153 117 223 195 310 110 150 17 450 138 269 160 79 448 97 331 329 64 34 266 425 158 50 428 3...
output:
B 55592
result:
ok single line: 'B 55592'
Test #17:
score: 0
Accepted
time: 10ms
memory: 16964kb
input:
419 488 118 121 45 8 353 238 222 25 447 242 281 21 354 164 443 463 363 479 460 189 26 113 402 95 238 54 293 284 29 332 231 92 432 19 466 106 37 455 483 335 429 98 117 115 461 67 183 110 191 457 389 40 308 461 368 33 418 279 403 418 477 6 2 24 55 81 76 50 128 369 231 61 348 186 330 106 455 47 45 187 ...
output:
B 81804
result:
ok single line: 'B 81804'
Test #18:
score: 0
Accepted
time: 11ms
memory: 17300kb
input:
516 437 166 429 287 301 392 436 107 276 257 310 135 92 78 16 99 256 250 159 229 270 39 339 177 263 65 15 19 50 133 154 37 129 407 50 127 95 419 319 124 240 181 198 249 414 48 284 347 337 186 177 89 204 324 391 118 276 41 151 13 176 417 171 56 283 322 170 51 205 301 47 264 297 58 169 427 219 434 377 ...
output:
A 37683
result:
ok single line: 'A 37683'
Test #19:
score: 0
Accepted
time: 16ms
memory: 17752kb
input:
549 408 158 318 74 304 343 378 243 334 47 16 146 344 319 315 243 158 149 389 261 199 114 109 189 81 84 279 297 323 76 34 371 282 90 308 94 392 363 401 174 179 54 327 361 103 335 66 302 8 180 247 248 47 86 184 95 76 194 238 263 174 273 380 196 271 47 83 83 83 28 403 385 236 223 168 216 34 62 379 108 ...
output:
A 100575
result:
ok single line: 'A 100575'
Test #20:
score: 0
Accepted
time: 14ms
memory: 17412kb
input:
493 432 262 140 157 169 251 150 53 224 347 401 306 98 162 232 230 10 161 264 121 19 81 47 371 16 253 367 162 265 45 264 41 364 80 295 327 403 150 250 256 291 68 245 103 315 180 424 252 79 317 251 22 162 26 392 398 39 267 24 17 276 117 199 75 12 244 61 164 311 371 69 106 186 423 173 417 339 336 49 15...
output:
B 82364
result:
ok single line: 'B 82364'
Test #21:
score: 0
Accepted
time: 2ms
memory: 9444kb
input:
4 3 3 1 1 2 3 3 2 2 1 1 2 3 3
output:
B 8
result:
ok single line: 'B 8'
Test #22:
score: 0
Accepted
time: 22ms
memory: 18572kb
input:
545 451 222 156 73 31 335 308 335 402 163 2 138 356 389 239 301 293 202 97 242 409 260 100 50 425 62 244 65 158 181 205 58 436 198 283 316 401 221 332 82 90 36 270 166 195 442 191 330 146 289 426 19 121 279 354 419 303 214 69 92 14 149 322 37 7 246 395 44 211 17 98 57 216 302 52 37 181 225 432 357 3...
output:
B 114994
result:
ok single line: 'B 114994'
Test #23:
score: 0
Accepted
time: 17ms
memory: 17608kb
input:
443 494 263 328 34 262 459 361 217 407 218 192 488 249 170 28 316 314 4 429 11 478 171 299 116 427 92 51 317 161 89 332 178 359 275 177 169 385 148 197 393 266 334 443 409 239 369 437 190 387 37 417 14 14 171 485 1 235 305 255 488 23 404 353 47 134 24 391 408 440 228 425 34 324 415 423 194 436 470 4...
output:
B 116184
result:
ok single line: 'B 116184'
Test #24:
score: 0
Accepted
time: 19ms
memory: 17476kb
input:
504 433 198 221 355 255 223 392 93 76 293 378 114 166 381 429 318 422 388 202 263 157 200 69 275 245 381 60 401 182 366 45 413 193 97 222 221 225 10 183 402 78 19 121 299 241 175 131 43 211 385 182 379 70 84 129 14 404 348 355 399 96 148 108 156 431 266 149 126 263 282 66 298 240 163 260 78 109 174 ...
output:
B 90402
result:
ok single line: 'B 90402'
Test #25:
score: 0
Accepted
time: 18ms
memory: 18012kb
input:
412 575 164 466 376 381 24 522 93 529 552 399 64 407 214 49 157 99 48 528 240 542 574 505 324 34 89 484 563 17 521 50 297 277 475 19 149 176 281 68 228 174 179 507 211 23 310 527 452 469 568 303 569 98 525 546 97 36 338 406 462 221 547 8 327 540 127 429 352 298 437 290 377 482 469 206 570 462 515 24...
output:
A 113223
result:
ok single line: 'A 113223'
Test #26:
score: 0
Accepted
time: 9ms
memory: 17832kb
input:
500 500 5 355 128 418 197 226 228 261 190 416 421 271 105 88 175 130 271 300 235 58 398 205 432 7 415 373 282 424 382 97 29 430 89 472 498 152 392 397 308 46 138 77 460 44 392 265 225 126 255 58 79 175 61 93 324 276 310 206 195 398 259 158 125 255 326 337 497 81 347 29 1 191 483 230 431 331 406 16 3...
output:
A 477
result:
ok single line: 'A 477'
Test #27:
score: 0
Accepted
time: 6ms
memory: 17872kb
input:
500 500 10 306 403 478 23 421 265 98 134 471 13 260 484 426 118 43 184 157 145 31 369 264 333 334 384 228 407 34 151 74 37 358 3 51 272 467 164 194 423 42 409 252 472 434 498 32 335 375 73 256 19 50 275 151 463 205 216 38 496 263 440 16 227 112 239 394 485 424 206 21 93 304 315 192 347 38 405 390 27...
output:
B 1742
result:
ok single line: 'B 1742'
Test #28:
score: 0
Accepted
time: 24ms
memory: 19156kb
input:
500 500 20 129 108 412 207 118 371 97 469 22 66 98 34 474 446 224 35 235 11 287 69 44 232 437 51 79 252 197 123 214 76 147 167 437 371 458 166 190 354 468 444 413 403 261 60 394 479 460 139 490 337 385 212 292 351 407 409 160 365 288 473 106 400 89 500 486 223 371 472 243 469 230 441 242 334 292 408...
output:
A 203719
result:
ok single line: 'A 203719'
Test #29:
score: 0
Accepted
time: 28ms
memory: 19172kb
input:
500 500 30 342 144 212 241 102 128 112 52 200 256 386 88 346 277 282 311 101 77 30 22 353 409 280 148 474 478 267 232 463 245 283 53 48 251 197 499 161 26 425 153 337 38 260 270 477 263 499 309 464 167 381 176 230 33 82 188 390 276 441 427 438 481 263 192 347 375 198 146 410 496 307 277 447 337 30 4...
output:
D
result:
ok single line: 'D'
Test #30:
score: 0
Accepted
time: 30ms
memory: 19100kb
input:
500 500 250 7 320 137 435 362 185 181 128 382 439 44 449 31 81 415 203 97 45 307 102 148 11 392 404 241 290 37 73 15 4 216 410 55 500 431 446 467 374 140 383 168 170 94 192 479 271 228 94 212 421 411 197 363 482 300 418 80 49 281 336 88 471 371 90 463 495 404 136 139 227 346 447 143 386 118 245 441 ...
output:
D
result:
ok single line: 'D'
Test #31:
score: 0
Accepted
time: 33ms
memory: 19024kb
input:
500 500 490 176 474 283 261 348 52 457 40 143 329 127 219 122 7 182 129 327 36 462 186 352 437 431 287 213 392 344 349 236 434 485 474 401 23 86 318 175 482 112 407 14 190 394 490 162 254 83 149 401 370 147 9 311 15 105 256 51 42 472 220 357 243 114 131 430 17 245 239 10 489 18 424 451 1 214 236 130...
output:
D
result:
ok single line: 'D'
Test #32:
score: 0
Accepted
time: 2ms
memory: 9440kb
input:
4 3 4 1 1 2 3 3 2 2 1 1 2 3 3
output:
D
result:
ok single line: 'D'
Test #33:
score: 0
Accepted
time: 28ms
memory: 19128kb
input:
500 500 500 448 316 444 442 239 229 42 126 11 5 277 368 223 194 244 229 392 305 84 483 104 85 164 24 92 291 469 117 271 391 74 385 106 151 383 357 306 140 467 161 471 153 424 401 144 265 302 417 76 382 48 421 398 134 48 110 183 437 323 157 451 122 232 435 264 343 237 7 178 91 166 253 393 485 279 104...
output:
D
result:
ok single line: 'D'
Test #34:
score: 0
Accepted
time: 36ms
memory: 32236kb
input:
1 239297 18 126344 158136 60056 127066 65598 189638 5515 16217 58949 163152 111081 64910 233118 130763 176190 59059 232446 49778 232753 57386 106594 237979 149689 231849 199785 80729 143273 162717 158635 188148 61398 210250 169096 190610 106959 150574 148720 126684 94985 126089 180624 231528 207320 ...
output:
B 233176
result:
ok single line: 'B 233176'
Test #35:
score: 0
Accepted
time: 28ms
memory: 23008kb
input:
3 83297 18 55943 67815 34636 49764 72632 47295 11615 52751 55057 28017 44437 51803 8229 32284 18042 60893 62137 52885 72635 29369 48343 67753 49828 63136 23426 67756 63748 19623 23363 25927 5935 16025 22808 29535 1115 46240 42134 23877 79390 80902 4741 59710 80371 32980 60045 38993 38851 17940 33591...
output:
A 173839
result:
ok single line: 'A 173839'
Test #36:
score: 0
Accepted
time: 15ms
memory: 19864kb
input:
7 35356 17 22673 6028 6418 5994 24875 18338 8670 10559 31332 27419 21445 20089 12415 18429 22524 23614 21560 21292 29448 21029 15228 23631 35341 25392 19525 16829 16998 30373 3468 4947 4894 14153 5250 4475 33709 866 15331 30799 9394 5283 14076 12292 10439 9928 34486 34668 26863 17816 27174 19071 118...
output:
B 53778
result:
ok single line: 'B 53778'
Test #37:
score: 0
Accepted
time: 45ms
memory: 20228kb
input:
21 11883 23 3540 6308 6609 5205 8845 11311 9401 1656 962 2805 3416 10760 8174 117 9528 11111 3432 11881 3552 6415 6702 5629 7852 11218 981 521 2966 2394 4699 472 3602 10038 1472 10467 9488 4098 2322 1890 6261 10448 11444 9369 10872 4196 9638 10784 8504 7561 1455 3725 10490 4735 8176 4237 4042 2683 1...
output:
D
result:
ok single line: 'D'
Test #38:
score: 0
Accepted
time: 12ms
memory: 18120kb
input:
73 3421 20 1508 3358 705 851 1423 3215 679 671 1200 1724 1649 2213 513 2505 1248 3213 1565 350 2877 1631 3119 2044 251 479 801 2562 2373 1033 3226 537 1988 953 66 259 1946 1935 2592 2325 2028 2614 360 2554 1924 2916 988 2502 323 2703 2750 1843 1292 1340 577 1266 357 2118 334 3416 598 2002 1911 385 1...
output:
A 13813
result:
ok single line: 'A 13813'
Test #39:
score: 0
Accepted
time: 20ms
memory: 18980kb
input:
239 1044 19 936 516 78 144 976 513 16 187 936 811 1027 77 509 822 303 805 845 1027 616 226 938 88 174 225 402 499 228 309 500 280 264 696 1015 828 867 332 973 426 480 483 360 987 123 359 295 548 365 393 517 577 950 683 629 82 24 14 979 618 293 759 805 488 285 652 447 60 589 3 140 272 87 518 15 34 93...
output:
A 134207
result:
ok single line: 'A 134207'
Test #40:
score: 0
Accepted
time: 29ms
memory: 18984kb
input:
876 284 20 156 132 237 186 204 236 93 92 208 159 105 11 242 195 14 223 193 194 216 97 21 88 115 213 267 117 177 251 85 148 28 58 79 272 188 272 87 90 267 147 186 165 96 73 125 237 95 165 22 240 264 215 98 50 83 18 91 158 90 205 21 81 136 238 229 14 226 235 223 184 160 151 279 139 177 77 269 14 186 9...
output:
D
result:
ok single line: 'D'
Test #41:
score: 0
Accepted
time: 21ms
memory: 18640kb
input:
4861 51 18 1 28 50 30 2 23 43 11 25 27 29 48 29 47 7 33 51 35 2 28 45 36 14 46 31 20 27 44 38 12 22 35 33 28 8 43 40 2 3 13 39 27 39 48 47 15 22 1 3 41 30 2 26 10 43 29 30 34 22 33 3 6 30 25 8 28 2 3 18 10 44 31 43 38 33 14 21 10 39 33 20 47 5 10 11 23 43 28 12 23 49 25 36 1 12 9 32 20 13 11 10 17 9...
output:
A 125963
result:
ok single line: 'A 125963'
Test #42:
score: 0
Accepted
time: 14ms
memory: 18208kb
input:
27301 9 16 7 7 4 8 1 9 2 3 7 2 7 2 6 4 4 4 4 9 7 5 8 4 9 2 7 5 4 1 2 5 1 8 6 9 9 7 3 9 9 5 7 1 4 1 6 1 2 9 4 9 1 1 8 1 4 9 3 5 3 7 5 5 8 8 7 5 9 6 3 7 8 6 8 1 5 6 9 6 5 1 2 9 3 6 7 1 2 2 9 2 7 8 6 2 8 4 5 8 7 7 7 1 1 3 3 5 6 4 9 9 8 1 2 8 8 3 3 6 8 4 3 4 7 8 4 8 3 2 3 9 6 5 2 2 6 4 8 9 9 4 6 2 3 6 9...
output:
B 44620
result:
ok single line: 'B 44620'
Test #43:
score: 0
Accepted
time: 10ms
memory: 17404kb
input:
102748 2 13 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 2 1 2 1 2 2 2 1 1 2 2 1 2 2 2 2 2 1 1 2 1 1 1 2 1 1 2 2 1 2 1 2 1 1 1 1 1 1 1 2 1 2 2 1 2 1 1 1 1 1 2 2 2 1 2 1 2 1 2 1 2 2 1 1 2 2 2 1 2 2 2 2 1 1 1 2 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 1 2 2 1 2 2 1 2 1 2 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 1 2 1 2 ...
output:
A 152909
result:
ok single line: 'A 152909'
Test #44:
score: 0
Accepted
time: 13ms
memory: 18640kb
input:
242810 1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
D
result:
ok single line: 'D'
Test #45:
score: 0
Accepted
time: 7ms
memory: 17512kb
input:
239027 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
A 1
result:
ok single line: 'A 1'
Test #46:
score: 0
Accepted
time: 14ms
memory: 25660kb
input:
2 125000 124862 62562 62562 62561 62561 62563 62563 62564 62564 62565 62565 62560 62560 62559 62559 62558 62558 62557 62557 62556 62556 62566 62566 62555 62555 62567 62567 62568 62568 62569 62569 62570 62570 62554 62554 62571 62571 62572 62572 62573 62573 62553 62553 62574 62574 62552 62552 62551 62...
output:
A 249997
result:
ok single line: 'A 249997'
Test #47:
score: 0
Accepted
time: 14ms
memory: 21676kb
input:
4 62500 62362 31412 31412 31413 31413 31414 31414 31411 31411 31410 31410 31409 31409 31408 31408 31415 31415 31416 31416 31417 31417 31407 31407 31418 31418 31419 31419 31420 31420 31421 31421 31422 31422 31406 31406 31405 31405 31423 31423 31404 31404 31424 31424 31425 31425 31426 31426 31403 3140...
output:
A 124999
result:
ok single line: 'A 124999'
Test #48:
score: 0
Accepted
time: 20ms
memory: 21372kb
input:
6 41666 41638 20682 20682 20681 20681 20680 20680 20683 20683 20684 20684 20679 20679 20678 20678 20685 20685 20686 20686 20687 20687 20688 20688 20677 20677 20689 20689 20690 20690 20676 20676 20691 20691 20675 20675 20692 20692 20674 20674 20673 20673 20672 20672 20671 20671 20693 20693 20670 2067...
output:
A 249991
result:
ok single line: 'A 249991'
Test #49:
score: 0
Accepted
time: 11ms
memory: 19064kb
input:
83333 3 83329 2 3 2 1 2 3 1 1 2 3 2 3 2 1 2 3 1 1 2 3 2 1 2 3 2 1 1 1 2 3 2 3 1 3 2 3 2 3 2 1 2 3 1 3 1 3 2 3 1 3 2 1 2 3 2 1 2 1 2 3 2 1 1 1 1 3 2 3 2 3 1 3 2 1 2 3 2 3 2 3 1 3 1 3 2 3 2 1 2 3 1 3 2 1 1 3 2 1 2 3 2 3 1 1 2 3 2 1 2 3 2 3 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 1 3 1 3 1 1 2 1 2 ...
output:
A 249985
result:
ok single line: 'A 249985'
Test #50:
score: 0
Accepted
time: 19ms
memory: 19088kb
input:
62500 4 62491 4 1 3 1 3 1 3 2 3 1 3 2 3 1 3 1 4 1 3 2 3 2 4 2 4 1 3 2 3 1 3 1 3 2 4 1 3 1 4 1 3 2 3 2 3 2 4 1 3 1 3 2 4 1 4 2 4 2 3 2 4 1 3 2 3 1 4 1 4 2 4 1 3 1 4 2 3 2 4 1 3 2 3 2 3 2 3 2 3 1 3 2 4 2 3 2 3 1 3 1 4 1 4 1 4 1 4 2 3 1 4 2 3 1 4 1 4 1 4 2 4 1 3 1 4 1 3 1 3 1 3 1 4 1 3 2 4 1 3 2 4 2 4 ...
output:
A 249953
result:
ok single line: 'A 249953'
Test #51:
score: 0
Accepted
time: 16ms
memory: 19048kb
input:
50000 5 49991 5 3 4 5 1 2 1 3 1 5 5 3 1 2 5 3 1 3 4 2 4 3 5 3 1 3 4 5 1 5 4 3 5 3 1 3 1 2 4 3 1 5 1 3 4 5 4 5 4 2 1 5 1 2 4 3 1 2 5 5 4 3 5 2 1 2 4 5 1 3 4 3 5 2 4 2 4 3 1 2 5 3 1 2 4 2 1 2 1 3 4 2 5 2 5 2 5 3 1 2 1 3 4 2 5 3 1 2 1 3 4 5 5 3 1 5 4 3 1 5 4 2 1 2 1 2 1 3 5 3 5 3 5 3 1 3 4 2 4 3 1 3 4 ...
output:
B 249946
result:
ok single line: 'B 249946'