QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#128381 | #6402. MEXimum Spanning Tree | Energy_is_not_over | AC ✓ | 16ms | 3916kb | C++17 | 6.3kb | 2023-07-20 22:10:41 | 2023-07-20 22:10:47 |
Judging History
answer
//
// Created by Barichek on 20.07.2023 12:22:31
//
#include <bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define all(a) a.begin(), a.end()
#define len(a) (int) (a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
//#define Energy_is_not_over
#ifdef Energy_is_not_over
#define DEBUG for (bool ____DEBUG = true; ____DEBUG; ____DEBUG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template<class ...Ts>
auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define DEBUG while (false)
#define LOG(...)
#endif
const int max_n = 1000+10, inf = 1000111222;
int n,m;
vector<pii> reb[max_n];
vector<pair<pii,int>> edges[max_n];
pair<pii,int> edge_value[max_n];
bool matr[max_n];
bitset<max_n> color_used_in_matr;
bitset<max_n> edges_with_this_color[max_n];
int X;
bool used[max_n];
int comp_id[max_n];
bitset<max_n> dfs_pref_xor[max_n];
void dfs(int now,int cur_comp_id)
{
used[now]=1;
comp_id[now]=cur_comp_id;
for (auto wh:reb[now]){
if (!used[wh.fir] && matr[wh.sec]){
dfs_pref_xor[wh.fir]=dfs_pref_xor[now];
dfs_pref_xor[wh.fir][wh.sec]=1;
dfs(wh.fir,cur_comp_id);
}
}
}
bool green[max_n];
bool yellow[max_n];
bitset<max_n> not_used_bfs;
int pred_bfs[max_n];
bitset<max_n> cur_go_bfs;
bitset<max_n> not_matr_not_color_from_matr;
bool augment()
{
LOG("augment");
memset(used,0,sizeof(used));
int comps=0;
for (int i=0;i<n;i++){
if (!used[i]){
dfs_pref_xor[i].reset();
dfs(i,comps);
comps++;
}
}
color_used_in_matr.reset();
for (int i=0;i<m;i++){
if (matr[i]){
int w=edge_value[i].sec;
assert(!color_used_in_matr[w]);
color_used_in_matr[w]=1;
}
}
for (int i=0;i<m;i++){
if (!matr[i]){
int u=edge_value[i].fir.fir;
int v=edge_value[i].fir.sec;
int w=edge_value[i].sec;
if (w<X && !color_used_in_matr[w] && comp_id[u]!=comp_id[v]){
color_used_in_matr[w]=1;
matr[i]=1;
LOG("naive",i);
return true;
}
}
}
memset(green,0,sizeof(green));
memset(yellow,0,sizeof(yellow));
for (int i=0;i<m;i++){
if (!matr[i]){
int u=edge_value[i].fir.fir;
int v=edge_value[i].fir.sec;
int w=edge_value[i].sec;
if (w<X && !color_used_in_matr[w]){
green[i]=1;
LOG("green",i);
}
if (w<X && comp_id[u]!=comp_id[v]){
yellow[i]=1;
LOG("yellow",i);
}
}
}
not_matr_not_color_from_matr.reset();
for (int i=0;i<m;i++){
if (!matr[i]){
int w=edge_value[i].sec;
if (w<X && !color_used_in_matr[w]){
not_matr_not_color_from_matr[i]=1;
}
}
}
{
not_used_bfs.reset();
for (int i=0;i<m;i++){
not_used_bfs[i]=1;
pred_bfs[i]=-2;
int w=edge_value[i].sec;
if (w>=X){
not_used_bfs[i]=0;
pred_bfs[i]=-3;
}
}
queue<int> q;
for (int i=0;i<m;i++){
if (green[i]){
not_used_bfs[i]=0;
q.push(i);
pred_bfs[i]=-1;
}
}
while (!q.empty()){
int now=q.front();
q.pop();
LOG("bfs",now);
int u=edge_value[now].fir.fir;
int v=edge_value[now].fir.sec;
int w=edge_value[now].sec;
if (!matr[now]){
if (yellow[now]){
LOG("found",now);
int curr=now;
while (curr!=-1){
LOG("curr",curr);
matr[curr]^=1;
curr=pred_bfs[curr];
assert(curr!=-2);
assert(curr!=-3);
}
return true;
}
cur_go_bfs=(not_used_bfs&(dfs_pref_xor[u]^dfs_pref_xor[v]));
for (int i=cur_go_bfs._Find_first();i<max_n;i=cur_go_bfs._Find_next(i)){
not_used_bfs[i]=0;
q.push(i);
pred_bfs[i]=now;
LOG("bfs go first type",now,i);
}
}
else{
cur_go_bfs=(not_used_bfs&(not_matr_not_color_from_matr|edges_with_this_color[w]));
for (int i=cur_go_bfs._Find_first();i<max_n;i=cur_go_bfs._Find_next(i)){
not_used_bfs[i]=0;
q.push(i);
pred_bfs[i]=now;
LOG("bfs go second type",now,i);
}
}
}
}
return false;
}
bool check(int XX)
{
X=XX;
memset(matr,0,sizeof(matr));
for (int i=0;i<X;i++){
if (!augment()){
return false;
}
}
return true;
}
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n>>m;
for (int i=0;i<m;i++){
int u,v,w;
cin>>u>>v>>w;
u--;
v--;
edge_value[i]=mp(mp(u,v),w);
edges[w].pb(mp(mp(u,v),i));
reb[u].pb(mp(v,i));
reb[v].pb(mp(u,i));
edges_with_this_color[w][i]=1;
}
for (int i=0;i<n+10;i++){
X=i+1;
if (!augment()){
cout<<i<<"\n";
return 0;
}
}
return 0;
}
/*
7 10
1 2 0
1 2 0
1 2 1
1 2 0
1 3 2
1 4 2
1 5 2
5 6 7
4 7 7
6 7 0
5 6
5 6 2
1 2 3
2 3 4
3 4 5
4 5 0
5 1 1
2 4
1 2 3
2 1 2
1 2 0
2 1 1
8 12
1 2 0
1 3 3
3 4 1
3 5 0
4 7 2
5 6 4
6 8 3
2 3 0
3 6 2
1 5 6
2 4 1
4 6 5
4 4
1 2 0
2 3 1
1 3 1
3 4 2
*/
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3524kb
input:
4 4 1 2 0 2 3 1 1 3 1 3 4 2
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 6ms
memory: 3840kb
input:
1000 1000 647 790 6 91 461 435 90 72 74 403 81 240 893 925 395 817 345 136 88 71 821 831 962 53 164 270 298 14 550 317 99 580 81 26 477 488 977 474 861 413 483 167 872 675 17 819 327 449 594 242 68 381 983 319 867 582 358 869 225 669 274 352 392 40 388 998 246 477 44 508 979 286 483 776 71 580 438 6...
output:
502
result:
ok 1 number(s): "502"
Test #3:
score: 0
Accepted
time: 10ms
memory: 3852kb
input:
900 1000 232 890 107 425 399 19 5 74 753 105 333 163 779 42 582 359 647 524 767 409 48 239 780 443 484 489 546 97 634 562 627 866 714 500 357 590 60 728 591 407 686 210 547 32 370 76 772 500 407 584 772 73 699 69 332 847 516 829 754 727 562 756 678 819 303 128 781 667 263 535 672 767 89 762 216 878 ...
output:
801
result:
ok 1 number(s): "801"
Test #4:
score: 0
Accepted
time: 5ms
memory: 3712kb
input:
500 1000 381 118 230 258 331 21 403 71 207 170 2 125 467 99 6 369 100 492 70 187 352 99 163 123 135 51 352 461 175 486 275 194 236 299 14 19 16 1 68 7 229 316 235 433 320 411 179 463 112 329 326 464 169 52 377 93 51 84 336 335 42 240 379 182 496 344 377 481 195 88 286 491 199 425 165 37 292 44 197 2...
output:
403
result:
ok 1 number(s): "403"
Test #5:
score: 0
Accepted
time: 12ms
memory: 3876kb
input:
900 1000 698 454 775 6 762 755 585 346 86 220 245 253 54 634 184 634 249 234 454 363 546 520 799 501 103 346 134 381 346 792 835 782 614 359 220 485 634 68 54 411 220 439 701 364 791 220 876 15 70 346 317 220 461 769 577 431 117 488 107 706 160 39 864 220 172 721 431 400 556 801 364 716 37 845 83 99...
output:
801
result:
ok 1 number(s): "801"
Test #6:
score: 0
Accepted
time: 5ms
memory: 3732kb
input:
500 1000 7 326 457 269 363 262 414 164 422 416 321 391 37 180 315 304 212 80 483 439 185 221 55 236 456 428 164 401 142 133 42 197 327 366 389 181 125 492 347 220 277 308 316 426 192 29 95 268 50 87 366 62 394 136 480 255 287 363 39 366 489 103 302 477 370 418 16 82 259 374 398 298 77 224 64 402 474...
output:
404
result:
ok 1 number(s): "404"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
1000 1000 404 572 946 963 590 625 691 563 394 297 369 699 379 667 345 285 219 775 860 851 693 393 962 118 78 19 178 986 466 284 14 709 603 897 698 491 432 875 675 268 886 372 599 1000 151 938 435 978 554 22 577 53 804 686 932 195 192 974 100 267 195 219 790 545 242 669 720 623 317 181 514 48 75 373 ...
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 12ms
memory: 3852kb
input:
1000 1000 856 130 621 913 107 385 323 657 942 779 980 628 466 126 230 363 663 577 714 515 741 397 70 459 819 227 31 588 941 524 248 131 529 398 621 657 128 974 220 729 419 300 337 976 204 574 239 122 661 356 49 833 411 778 589 699 181 919 657 458 742 280 270 403 878 5 882 489 3 573 674 954 798 99 29...
output:
667
result:
ok 1 number(s): "667"
Test #9:
score: 0
Accepted
time: 5ms
memory: 3884kb
input:
1000 1000 224 443 706 443 724 126 443 586 793 161 443 52 443 147 450 443 140 390 443 276 715 443 909 189 84 745 544 21 879 174 703 443 353 443 414 332 543 443 141 920 443 154 443 558 384 443 794 212 937 745 536 168 443 119 692 443 736 443 634 268 588 443 752 443 895 740 745 729 209 443 827 996 338 4...
output:
236
result:
ok 1 number(s): "236"
Test #10:
score: 0
Accepted
time: 13ms
memory: 3892kb
input:
1000 1000 798 241 635 439 138 474 251 966 10 394 250 763 673 724 587 333 150 384 825 333 785 952 923 506 131 333 777 172 754 207 253 172 580 394 496 435 138 578 181 658 289 458 87 241 64 888 729 604 333 638 641 548 966 789 205 138 198 372 966 799 497 333 220 923 412 724 333 347 128 769 138 685 331 3...
output:
791
result:
ok 1 number(s): "791"
Test #11:
score: 0
Accepted
time: 2ms
memory: 3912kb
input:
1000 1000 263 550 562 16 86 168 130 138 878 947 761 527 908 622 222 374 942 114 218 643 282 240 102 639 470 374 651 646 151 538 324 7 710 825 835 307 808 473 577 356 677 15 887 572 558 764 340 18 263 756 365 40 407 162 300 715 469 604 358 23 433 415 579 198 720 930 626 801 869 863 589 300 560 116 40...
output:
19
result:
ok 1 number(s): "19"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
800 1000 711 767 733 68 352 762 232 36 276 511 777 102 552 332 366 608 135 442 686 184 347 608 281 273 334 427 709 678 385 192 278 527 645 287 285 595 630 409 751 382 665 145 745 330 650 656 31 155 777 25 327 685 212 456 202 132 745 707 163 363 241 421 56 157 510 718 17 734 199 496 157 140 185 422 4...
output:
4
result:
ok 1 number(s): "4"
Test #13:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
800 1000 774 151 780 578 702 395 739 410 171 566 355 641 559 799 1 682 477 622 666 701 61 329 778 339 236 357 32 605 599 502 459 494 326 465 746 605 34 742 352 161 365 41 5 799 636 505 439 344 36 333 50 780 639 323 18 465 441 459 644 93 668 453 279 442 216 509 585 469 700 390 462 158 191 219 594 457...
output:
6
result:
ok 1 number(s): "6"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
800 1000 506 646 450 584 83 171 440 107 282 36 582 726 778 159 159 761 203 349 660 26 232 501 160 627 183 300 75 326 658 117 48 639 489 73 690 425 404 313 665 88 15 61 262 103 691 84 297 698 49 298 420 598 243 147 170 139 231 248 545 257 86 632 29 46 339 491 504 538 316 692 3 19 287 134 156 239 462 ...
output:
4
result:
ok 1 number(s): "4"
Test #15:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
800 1000 163 13 63 14 599 331 465 67 644 411 722 430 245 411 105 764 38 755 411 596 644 667 46 455 599 225 59 475 194 61 744 299 189 599 789 609 436 238 730 706 24 190 543 67 301 527 411 336 431 599 131 599 375 752 797 671 357 46 742 634 46 246 132 530 744 360 513 154 118 664 599 462 408 281 138 599...
output:
2
result:
ok 1 number(s): "2"
Test #16:
score: 0
Accepted
time: 2ms
memory: 3780kb
input:
800 1000 764 362 605 741 635 454 494 8 441 146 747 465 143 38 471 658 73 638 394 766 398 626 692 337 465 271 300 181 122 465 212 104 175 202 663 521 270 435 213 136 202 627 576 370 707 696 206 344 632 766 473 44 612 634 395 6 337 583 25 608 731 144 121 142 540 454 315 777 523 460 570 342 634 138 297...
output:
12
result:
ok 1 number(s): "12"
Test #17:
score: 0
Accepted
time: 2ms
memory: 3836kb
input:
800 1000 203 141 338 184 79 694 396 708 790 790 477 34 743 182 8 71 252 362 149 100 254 321 365 325 270 557 346 797 361 757 8 718 372 21 245 414 489 757 719 160 235 168 346 124 284 645 203 35 535 515 490 83 707 100 464 165 778 49 600 491 445 337 565 602 646 111 578 668 429 353 103 10 478 489 97 185 ...
output:
16
result:
ok 1 number(s): "16"
Test #18:
score: 0
Accepted
time: 2ms
memory: 3896kb
input:
800 1000 564 346 296 375 149 540 106 615 70 574 351 121 205 274 240 93 595 304 205 584 423 564 304 79 205 723 121 138 754 416 574 623 591 644 356 796 480 261 756 553 574 191 205 687 5 352 744 308 109 93 774 76 791 358 375 669 387 485 350 568 92 307 437 655 564 507 268 551 594 772 574 710 437 205 573...
output:
15
result:
ok 1 number(s): "15"
Test #19:
score: 0
Accepted
time: 2ms
memory: 3852kb
input:
800 1000 428 737 331 388 113 132 72 149 479 759 414 599 623 106 593 764 625 515 179 66 167 243 271 778 154 139 590 611 29 630 183 147 753 129 660 745 644 444 295 409 662 42 146 107 463 663 526 63 184 683 534 486 548 106 216 314 304 317 353 237 270 592 229 465 760 541 174 449 0 700 614 632 339 138 27...
output:
53
result:
ok 1 number(s): "53"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
800 1000 611 663 102 139 241 313 246 110 720 427 303 718 264 728 435 109 194 188 155 564 549 179 143 619 382 402 28 544 474 48 362 772 50 592 792 5 643 592 12 389 578 304 321 649 623 111 757 639 436 558 569 445 369 572 712 252 776 158 712 359 681 96 289 454 271 352 686 178 34 324 221 422 1 369 21 14...
output:
54
result:
ok 1 number(s): "54"
Test #21:
score: 0
Accepted
time: 2ms
memory: 3796kb
input:
800 1000 264 249 496 428 788 667 25 249 366 791 194 325 710 715 227 676 21 429 688 673 619 528 548 60 791 771 438 249 3 793 391 587 234 715 296 446 374 799 441 541 791 200 791 167 365 12 249 1 785 548 309 295 374 47 597 781 430 385 453 7 791 429 83 249 484 796 3 753 563 361 249 582 791 206 277 548 1...
output:
52
result:
ok 1 number(s): "52"
Test #22:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
800 1000 214 704 283 439 177 321 704 79 514 558 435 609 565 749 263 733 438 98 714 352 65 176 153 434 764 284 184 412 15 11 402 374 265 151 663 790 655 468 496 58 590 719 595 613 760 178 27 193 707 799 430 100 671 31 625 782 704 577 639 650 237 345 101 548 87 686 377 99 628 4 544 179 372 301 584 265...
output:
108
result:
ok 1 number(s): "108"
Test #23:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
800 1000 116 756 233 618 415 636 234 176 51 640 67 89 717 624 467 150 329 395 471 110 374 681 638 549 355 2 490 333 604 56 481 621 591 348 11 474 362 108 447 610 450 209 50 258 541 161 407 82 178 49 631 691 293 510 21 797 796 414 110 49 43 73 733 695 264 64 444 399 199 677 347 389 153 117 4 338 202 ...
output:
102
result:
ok 1 number(s): "102"
Test #24:
score: 0
Accepted
time: 3ms
memory: 3844kb
input:
800 1000 475 652 662 414 481 502 20 28 334 74 491 608 344 598 420 287 632 494 590 215 27 493 81 64 365 187 442 239 679 71 785 287 336 705 414 24 414 230 411 80 414 683 299 414 0 287 136 423 414 578 433 562 12 721 12 176 681 221 590 67 261 307 73 414 590 78 237 287 118 97 355 720 99 408 533 146 414 3...
output:
107
result:
ok 1 number(s): "107"
Test #25:
score: 0
Accepted
time: 7ms
memory: 3836kb
input:
800 1000 745 299 226 798 599 624 206 284 22 787 710 30 528 14 409 182 20 558 489 457 270 559 530 378 154 76 377 129 768 545 111 283 343 443 503 186 578 299 367 242 673 32 101 573 341 81 543 299 462 242 202 187 431 194 178 433 24 400 465 753 555 479 13 578 66 199 634 795 577 295 676 102 400 70 181 71...
output:
403
result:
ok 1 number(s): "403"
Test #26:
score: 0
Accepted
time: 7ms
memory: 3784kb
input:
800 1000 421 568 88 554 57 297 166 606 182 670 393 344 335 234 195 574 778 483 523 148 187 400 726 309 349 79 417 488 146 267 313 447 562 567 760 85 531 478 215 196 153 749 117 112 132 730 344 308 375 89 798 200 34 556 533 26 345 297 736 646 83 590 723 177 491 268 512 253 161 84 92 86 506 773 119 26...
output:
405
result:
ok 1 number(s): "405"
Test #27:
score: 0
Accepted
time: 7ms
memory: 3840kb
input:
800 1000 280 747 242 348 658 502 389 560 416 137 202 102 643 431 628 251 643 281 643 658 385 643 2 186 541 43 9 47 310 570 643 631 317 202 180 352 643 204 737 661 229 587 663 280 100 643 222 506 529 792 450 4 774 348 322 643 347 280 637 193 253 202 21 280 790 548 402 643 654 375 542 77 431 369 99 54...
output:
408
result:
ok 1 number(s): "408"
Test #28:
score: 0
Accepted
time: 12ms
memory: 3892kb
input:
800 1000 140 450 637 180 165 220 235 623 132 641 43 398 531 249 540 521 506 129 739 303 206 208 448 32 121 661 663 726 654 458 73 396 656 154 131 440 443 477 214 280 506 56 171 439 531 440 187 658 358 120 724 709 174 353 588 217 579 497 532 417 536 105 204 400 360 305 32 283 629 565 645 130 271 88 3...
output:
799
result:
ok 1 number(s): "799"
Test #29:
score: 0
Accepted
time: 10ms
memory: 3892kb
input:
900 1000 757 851 24 652 105 630 49 845 434 642 313 764 304 699 702 85 539 258 140 381 62 830 252 221 273 367 883 255 118 390 285 181 397 699 231 168 194 50 417 285 570 644 156 545 231 18 105 457 869 373 271 42 46 614 506 203 449 402 392 590 138 503 576 514 418 750 428 278 182 281 880 228 535 538 142...
output:
899
result:
ok 1 number(s): "899"
Test #30:
score: 0
Accepted
time: 16ms
memory: 3916kb
input:
1000 1000 786 825 531 928 449 459 852 46 234 797 939 354 233 543 812 799 257 149 270 126 583 753 239 555 175 374 519 985 485 696 308 259 869 211 109 40 863 608 817 208 738 502 664 228 558 480 33 539 269 333 907 574 965 493 589 758 766 791 1000 983 27 422 718 207 416 340 657 424 225 764 345 453 798 9...
output:
999
result:
ok 1 number(s): "999"
Test #31:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
1 1000 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 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 0 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0...
output:
0
result:
ok 1 number(s): "0"
Test #32:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
2 1000 2 2 0 1 2 2 2 2 1 2 2 0 1 2 0 1 1 1 1 2 1 1 1 2 2 1 0 1 2 1 1 2 2 1 2 0 1 2 0 1 1 2 1 2 0 2 2 0 1 1 1 2 1 0 1 1 0 1 1 2 2 2 1 1 2 2 2 1 2 2 2 2 2 1 2 2 1 2 2 1 2 2 1 0 2 2 2 1 1 1 2 1 1 2 2 0 1 1 1 2 1 0 1 1 1 1 2 2 2 2 0 2 2 0 1 1 0 2 2 0 2 2 0 1 1 2 1 2 1 1 2 1 2 1 1 1 2 0 1 2 2 1 1 0 1 2 0...
output:
1
result:
ok 1 number(s): "1"
Test #33:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
3 1000 2 3 3 2 1 0 2 3 0 3 2 0 2 3 1 2 3 0 2 1 0 1 3 2 3 3 1 2 3 0 1 3 0 3 3 2 1 1 1 3 2 1 1 3 3 1 2 0 2 1 2 2 2 1 3 2 2 2 3 3 3 2 1 3 2 2 1 1 2 2 1 1 3 1 0 3 3 2 3 3 1 3 2 0 1 1 1 2 3 0 3 3 0 1 2 1 2 1 1 2 3 0 2 3 2 2 2 2 2 3 1 2 1 3 2 2 1 2 3 1 1 2 0 1 1 1 1 3 1 3 2 1 3 2 3 3 2 1 3 3 3 1 1 0 2 3 3...
output:
2
result:
ok 1 number(s): "2"
Test #34:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
1 0
output:
0
result:
ok 1 number(s): "0"
Test #35:
score: 0
Accepted
time: 1ms
memory: 3856kb
input:
1000 999 424 501 424 397 773 536 990 95 481 37 170 825 440 924 663 640 444 280 744 463 313 483 25 915 573 752 38 945 670 812 515 298 473 284 984 609 168 274 177 108 730 750 351 566 98 836 631 356 928 831 226 497 867 488 947 463 849 788 421 348 717 658 102 986 322 927 32 662 667 639 285 939 93 651 97...
output:
1
result:
ok 1 number(s): "1"
Test #36:
score: 0
Accepted
time: 4ms
memory: 3820kb
input:
500 1000 254 302 426 154 494 48 494 483 462 82 7 230 494 405 146 265 251 362 90 380 247 55 101 441 172 494 217 294 122 91 276 39 11 494 338 75 55 66 232 328 308 205 79 309 498 494 293 130 238 344 494 431 494 100 179 494 203 498 477 8 351 283 164 300 226 54 426 99 266 436 403 263 144 143 74 494 245 1...
output:
260
result:
ok 1 number(s): "260"
Test #37:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
100 1000 92 44 18 91 82 73 98 21 68 71 75 34 76 65 29 67 19 94 92 19 100 97 95 2 85 30 19 41 17 54 51 3 31 52 7 31 70 13 54 42 22 37 24 39 25 14 26 29 68 25 70 65 40 34 94 25 24 32 80 10 74 29 73 64 10 28 39 43 62 9 4 4 35 98 60 41 50 57 55 69 65 85 44 36 75 56 64 72 13 22 85 12 94 76 99 62 95 55 21...
output:
99
result:
ok 1 number(s): "99"
Test #38:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
50 1000 12 25 46 29 31 49 42 43 22 42 39 34 27 47 40 24 30 28 39 50 12 38 13 33 40 10 4 45 31 37 31 16 44 30 22 40 27 6 4 8 29 37 36 11 15 33 2 9 41 15 36 48 45 29 40 50 29 26 42 47 42 3 47 4 11 20 9 28 30 5 22 12 27 30 17 27 39 48 43 18 42 27 1 16 38 12 0 38 19 20 20 31 46 43 14 0 21 29 35 39 26 22...
output:
49
result:
ok 1 number(s): "49"
Test #39:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
20 1000 4 14 15 17 20 19 14 1 3 4 16 4 10 5 9 10 11 15 10 14 11 16 19 12 10 3 1 1 19 14 16 3 19 18 19 8 12 4 20 2 4 2 15 14 0 7 8 16 3 19 2 16 1 19 1 20 3 1 19 15 15 16 16 11 16 17 1 10 10 10 14 5 5 8 2 20 16 6 5 14 12 9 6 14 1 14 19 6 17 6 2 3 8 1 3 14 15 15 16 12 10 15 15 19 18 2 1 15 5 7 17 13 3 ...
output:
19
result:
ok 1 number(s): "19"
Test #40:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
10 1000 4 5 4 9 1 2 6 1 5 10 1 4 4 3 9 9 7 7 3 3 3 8 6 9 10 2 2 10 6 2 7 2 4 7 9 6 8 4 7 6 10 8 8 1 9 9 5 6 1 5 2 8 10 10 2 1 3 2 3 9 7 7 8 9 6 4 9 8 9 10 2 2 2 6 8 10 6 4 4 1 2 5 9 5 10 9 3 10 6 1 6 1 5 5 2 7 8 3 7 7 4 9 8 4 0 6 1 1 8 1 0 1 9 7 10 9 7 1 6 0 3 9 7 2 1 10 3 10 2 10 7 6 3 8 7 3 2 0 8 ...
output:
9
result:
ok 1 number(s): "9"
Extra Test:
score: 0
Extra Test Passed