QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#93675 | #5521. Excellent XOR Problem | CUET_infinite_tsukuyomi# | WA | 36ms | 4648kb | C++17 | 2.0kb | 2023-04-02 02:56:37 | 2023-04-02 02:56:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long int li;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
//typedef long long int;
#define endl "\n"
#define f(i,a,b) for(int i=a;i<=(b);i++)
#define r(i,a,b) for(int i=a;i>=(b);i--)
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define mid(s,l) (s+(l-s)/2)
#define umap unordered_map
#define pb push_back
#define mp make_pair
//#define int long long
//const int INF = int(1e9);
//const int MOD = int(1e9) + 7;
//const ld EPS = 1e-18;
//const ld PI = acos(-1.0);
void GG()
{
int n;
cin >> n;
vector<int> v(n + 1);
vector<int> pref(n + 1);
for(int i = 1; i <= n; i++){
cin >> v[i];
pref[i] = pref[i - 1] ^ v[i];
}
if(n == 2){
if(v[1] == v[2]) cout << "NO" << endl;
else{
cout << "YES" << endl;
cout << 2 << endl;
cout << 1 << ' ' << 1 << endl;
cout << 2 << ' ' << 2 << endl;
}
return;
}
else{
for(int i = 2; i <= n - 1; i++){
int ls = pref[i - 1];
int ms = pref[i] ^ pref[i - 1];
int rs = pref[n] ^ pref[i];
if(ls != ms && ls != rs && ms != rs){
cout << "YES" << endl;
cout << 3 << endl;
cout << 1 << ' ' << i - 1 << endl;
cout << i << ' ' << i << endl;
cout << i + 1 << ' ' << n << endl;
return;
}
else if(ls == ms && ms == rs && rs == 0) continue;
else if(ls == ms && rs == 0) continue;
else if(ls == rs && ms == 0) continue;
else if(ms == rs && ls == 0) continue;
else{
cout << "YES" << endl;
cout << 2 << endl;
cout << 1 << ' ' << i << endl;
cout << i + 1 << ' ' << n << endl;
return;
}
}
cout << "NO" << endl;
return;
}
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int ttc=1;
cin>>ttc;
//int cnt=0;
while(ttc--)
{
//cout<<"Case "<<++cnt<<": ";
GG();
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3400kb
input:
4 2 0 0 3 1 2 3 5 16 8 4 2 1 6 42 42 42 42 42 42
output:
NO YES 3 1 1 2 2 3 3 YES 3 1 1 2 2 3 5 NO
result:
ok Correct (4 test cases)
Test #2:
score: 0
Accepted
time: 9ms
memory: 4556kb
input:
1 200000 0 0 104990627 0 104990627 0 0 0 0 104990627 0 104990627 0 0 104990627 104990627 0 0 0 0 0 104990627 0 0 0 104990627 104990627 104990627 0 104990627 0 104990627 104990627 0 104990627 0 0 0 104990627 104990627 0 0 104990627 104990627 0 0 104990627 0 0 0 0 0 104990627 104990627 0 0 0 0 0 10499...
output:
YES 2 1 2 3 200000
result:
ok Correct (1 test case)
Test #3:
score: 0
Accepted
time: 11ms
memory: 4560kb
input:
1 200000 916550535 1039111536 183367143 845311658 473404911 844600350 249761080 860927112 268559756 661297994 448456545 184790162 804023458 655065019 442145717 130497524 509071033 644651807 1039510287 766490362 514960668 612238468 863513676 417538457 839195481 901404895 760875212 983171045 343221187...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #4:
score: 0
Accepted
time: 16ms
memory: 4560kb
input:
1 200000 697100980 63360185 3577101 75632048 903073319 644702701 1017474476 268785811 6091842 227390753 270800416 554896940 318364388 526066510 354510498 1034952286 613138496 176305121 384248064 715019967 999545181 91222841 1063728923 665773338 354670745 473570604 220064105 301115885 1038664738 3094...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #5:
score: 0
Accepted
time: 16ms
memory: 4516kb
input:
1 200000 446225258 446225258 446225258 446225258 0 0 446225258 446225258 0 446225258 0 0 446225258 0 446225258 0 446225258 446225258 446225258 0 446225258 0 0 446225258 0 0 446225258 446225258 446225258 446225258 0 0 0 446225258 0 446225258 446225258 0 0 0 0 446225258 446225258 446225258 446225258 0...
output:
YES 3 1 139151 139152 139152 139153 200000
result:
ok Correct (1 test case)
Test #6:
score: 0
Accepted
time: 21ms
memory: 4632kb
input:
1 200000 917884074 0 917884074 917884074 0 0 0 917884074 917884074 0 917884074 0 0 0 917884074 0 917884074 917884074 0 917884074 0 917884074 0 917884074 0 917884074 0 0 917884074 0 0 0 0 917884074 0 0 917884074 0 0 917884074 0 0 0 917884074 0 0 917884074 917884074 917884074 0 917884074 917884074 917...
output:
NO
result:
ok Correct (1 test case)
Test #7:
score: 0
Accepted
time: 19ms
memory: 4556kb
input:
1 200000 38752313 357331606 537948798 987818688 44594898 45009755 99389192 639845557 292429925 1073152680 811573855 591475451 1008870823 139070983 91604841 527091101 925340882 918748711 565945042 560608781 305815075 675659609 590632841 336736157 1048580186 263809556 745114432 402434054 977511741 738...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #8:
score: 0
Accepted
time: 24ms
memory: 4624kb
input:
1 200000 893044581 455322080 358158755 218139078 474263307 918853931 867102588 47704257 29962011 639245440 633917727 961582229 523211753 10072474 3969623 357804040 1029408344 450402025 984424643 509138385 790399588 154643982 790848088 584971038 564055450 909717089 204303325 794120719 599213467 16634...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #9:
score: 0
Accepted
time: 22ms
memory: 4636kb
input:
1 200000 0 185376886 185376886 0 0 185376886 0 0 0 185376886 185376886 185376886 0 185376886 0 185376886 0 0 0 185376886 0 185376886 0 0 185376886 0 0 185376886 185376886 0 0 0 0 185376886 185376886 185376886 185376886 0 185376886 185376886 185376886 0 185376886 185376886 185376886 0 185376886 18537...
output:
YES 3 1 66721 66722 66722 66723 200000
result:
ok Correct (1 test case)
Test #10:
score: 0
Accepted
time: 19ms
memory: 4556kb
input:
1 200000 657035701 657035701 657035701 0 657035701 0 0 0 657035701 0 0 657035701 0 657035701 657035701 657035701 657035701 657035701 0 0 657035701 0 0 657035701 657035701 657035701 657035701 0 657035701 0 0 0 657035701 657035701 657035701 657035701 657035701 657035701 657035701 657035701 657035701 0...
output:
YES 2 1 2 3 200000
result:
ok Correct (1 test case)
Test #11:
score: 0
Accepted
time: 23ms
memory: 4560kb
input:
1 200000 858422083 738133618 507317400 938167375 459497018 1044660423 463406796 381197927 222652382 320503882 227297869 94859048 1041849577 22395538 867727705 113746555 121033531 998839546 547321231 944047181 838316629 703306016 929065075 831702287 292242396 594475369 700537839 114951735 741004316 3...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #12:
score: 0
Accepted
time: 8ms
memory: 4644kb
input:
1 200000 0 0 0 0 159868366 0 0 0 0 159868366 0 159868366 159868366 0 159868366 159868366 0 0 0 0 0 159868366 0 159868366 159868366 0 159868366 0 0 159868366 0 159868366 0 0 0 0 159868366 0 0 159868366 0 159868366 0 0 159868366 159868366 0 0 0 159868366 0 159868366 0 159868366 0 159868366 159868366 0...
output:
YES 2 1 2 3 200000
result:
ok Correct (1 test case)
Test #13:
score: 0
Accepted
time: 14ms
memory: 4568kb
input:
1 200000 0 0 0 631527185 0 0 0 0 631527185 0 0 0 0 631527185 0 631527185 0 0 0 0 631527185 0 631527185 631527185 0 0 0 631527185 0 631527185 631527185 631527185 0 0 0 631527185 0 631527185 0 631527185 631527185 0 0 0 631527185 631527185 0 631527185 0 631527185 0 0 631527185 631527185 631527185 0 0 0...
output:
YES 2 1 2 3 200000
result:
ok Correct (1 test case)
Test #14:
score: 0
Accepted
time: 20ms
memory: 4544kb
input:
1 200000 200073416 1032105039 1041689097 776612191 674760420 444967477 619063336 752257673 508990464 92523985 768071308 131437559 658614189 709141835 604822048 679627194 433235918 667541312 729018209 789635995 144586522 214000960 455968993 502665106 986151837 384714321 151846341 216269904 679851319 ...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #15:
score: 0
Accepted
time: 17ms
memory: 4628kb
input:
1 200000 1054365685 56353689 861899055 6932581 30687005 245069829 313034908 160116373 246522551 732358569 590415180 501544337 172955118 580143326 517186829 510340133 537303380 199194626 73755986 738165599 629171036 766727158 656184240 750899987 501627101 1030621854 684777058 607956568 301553045 1962...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #16:
score: 0
Accepted
time: 12ms
memory: 4624kb
input:
1 200000 972761816 972761816 0 0 0 0 0 972761816 0 972761816 972761816 0 972761816 0 972761816 0 0 972761816 0 972761816 972761816 972761816 0 0 972761816 972761816 972761816 0 972761816 972761816 0 0 972761816 0 972761816 0 972761816 972761816 972761816 972761816 0 972761816 0 0 0 972761816 0 97276...
output:
YES 2 1 2 3 200000
result:
ok Correct (1 test case)
Test #17:
score: 0
Accepted
time: 10ms
memory: 4636kb
input:
1 200000 615466573 252334636 502318970 615057008 890023823 919016355 774719876 49575596 795328547 938285912 235102923 168016069 275378801 322146308 341916391 171766010 745438304 336243078 910715187 635224808 524598239 798437728 1056614735 173627925 606319454 174953272 676896668 317588073 618698322 1...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #18:
score: 0
Accepted
time: 12ms
memory: 4636kb
input:
1 200000 396017018 350325110 322528928 919119221 245950407 719118707 468691448 531176119 532860634 504378671 57446795 538122848 863461554 193147799 254281172 2478948 849505767 941638216 255452964 583754413 1009182753 277422102 183088158 421862806 121794718 820860806 136085561 709274737 240400048 625...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #19:
score: 0
Accepted
time: 8ms
memory: 4560kb
input:
1 200000 240254620 240254620 0 0 0 0 240254620 240254620 0 240254620 240254620 240254620 240254620 240254620 240254620 240254620 0 240254620 240254620 0 0 240254620 240254620 240254620 0 0 240254620 240254620 0 240254620 0 0 0 240254620 0 240254620 0 240254620 0 0 240254620 0 240254620 240254620 240...
output:
YES 3 1 36111 36112 36112 36113 200000
result:
ok Correct (1 test case)
Test #20:
score: 0
Accepted
time: 10ms
memory: 4520kb
input:
1 200000 711913436 711913436 711913436 711913436 711913436 0 0 0 711913436 0 0 711913436 711913436 0 711913436 711913436 0 0 0 0 0 0 0 711913436 0 711913436 0 711913436 711913436 0 711913436 711913436 0 711913436 0 711913436 711913436 0 0 711913436 711913436 711913436 711913436 711913436 0 711913436...
output:
YES 2 1 2 3 200000
result:
ok Correct (1 test case)
Test #21:
score: 0
Accepted
time: 21ms
memory: 4648kb
input:
1 200000 556496957 599491909 1064758529 195572743 122274978 164089666 171295779 399095216 771461740 455276133 667723649 166819107 744520439 855408620 629777826 1051765207 261024403 511573799 743922497 652011161 800590597 531579900 170198475 603500551 485391878 1044502886 944661988 665346837 11913824...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #22:
score: 0
Accepted
time: 14ms
memory: 3760kb
input:
2 100000 834074965 802479352 920598314 872396637 780256286 163927241 263678492 397223877 6095204 156235661 1066538453 960385267 992353390 543334786 291831058 164061413 544994443 625732746 817631952 525924738 1066391946 961527978 978173652 1014843663 443127874 705524878 472068645 68137659 99653388 54...
output:
YES 3 1 1 2 2 3 100000 YES 2 1 2 3 100000
result:
ok Correct (2 test cases)
Test #23:
score: 0
Accepted
time: 19ms
memory: 3808kb
input:
2 100000 909567027 0 0 909567027 909567027 909567027 909567027 0 0 0 0 0 909567027 909567027 909567027 909567027 909567027 0 0 909567027 909567027 909567027 0 0 0 909567027 0 909567027 909567027 0 909567027 0 909567027 0 0 0 909567027 909567027 0 0 909567027 909567027 0 909567027 909567027 0 9095670...
output:
YES 3 1 1373 1374 1374 1375 100000 YES 2 1 2 3 100000
result:
ok Correct (2 test cases)
Test #24:
score: 0
Accepted
time: 17ms
memory: 3872kb
input:
2 100000 0 307484032 307484032 0 0 0 0 0 0 307484032 307484032 307484032 0 0 0 307484032 0 0 307484032 0 307484032 307484032 307484032 307484032 307484032 0 0 0 0 307484032 307484032 0 0 307484032 0 307484032 0 0 307484032 307484032 307484032 307484032 307484032 307484032 0 307484032 0 307484032 0 3...
output:
YES 2 1 2 3 100000 YES 3 1 1 2 2 3 100000
result:
ok Correct (2 test cases)
Test #25:
score: 0
Accepted
time: 20ms
memory: 3760kb
input:
2 100000 779142847 779142847 0 779142847 779142847 0 0 779142847 0 0 779142847 0 779142847 779142847 779142847 779142847 0 779142847 779142847 0 0 0 0 779142847 0 779142847 0 779142847 0 0 0 779142847 779142847 779142847 779142847 0 0 779142847 0 779142847 0 779142847 0 779142847 0 779142847 0 0 0 7...
output:
YES 2 1 2 3 100000 YES 2 1 2 3 100000
result:
ok Correct (2 test cases)
Test #26:
score: 0
Accepted
time: 20ms
memory: 3844kb
input:
2 100000 1030018566 120699423 201438145 1014903668 351446274 438078471 113306604 176142323 29965373 568090348 355913940 293328732 123458931 27340750 1015032006 560654991 961264292 899829650 344066707 320043156 857246353 1024949120 705292817 934041363 652512579 67929539 456307864 561142492 733943941 ...
output:
YES 3 1 1 2 2 3 100000 YES 3 1 1 2 2 3 100000
result:
ok Correct (2 test cases)
Test #27:
score: 0
Accepted
time: 11ms
memory: 3832kb
input:
2 100000 648718659 0 648718659 0 648718659 0 0 648718659 0 0 648718659 0 648718659 0 0 0 0 648718659 0 648718659 0 0 0 648718659 0 0 648718659 0 0 648718659 648718659 0 648718659 648718659 648718659 648718659 0 0 0 0 648718659 648718659 648718659 0 648718659 648718659 0 648718659 648718659 0 0 0 0 0...
output:
YES 3 1 12194 12195 12195 12196 100000 YES 3 1 86931 86932 86932 86933 100000
result:
ok Correct (2 test cases)
Test #28:
score: 0
Accepted
time: 20ms
memory: 3804kb
input:
2 100000 46635647 0 0 46635647 0 46635647 0 0 46635647 0 0 0 0 0 0 46635647 0 0 46635647 0 46635647 46635647 46635647 46635647 46635647 0 0 0 0 46635647 46635647 46635647 46635647 0 46635647 46635647 0 0 0 0 46635647 0 0 46635647 46635647 0 46635647 46635647 46635647 0 0 46635647 0 0 46635647 0 0 46...
output:
YES 3 1 4911 4912 4912 4913 100000 NO
result:
ok Correct (2 test cases)
Test #29:
score: 0
Accepted
time: 18ms
memory: 3840kb
input:
2 100000 0 518294466 0 0 518294466 0 0 0 0 518294466 518294466 518294466 518294466 518294466 0 0 0 0 518294466 0 518294466 518294466 0 0 0 518294466 0 0 518294466 518294466 0 0 0 0 0 0 0 0 518294466 518294466 0 518294466 518294466 518294466 0 518294466 0 0 518294466 0 0 0 518294466 0 518294466 51829...
output:
YES 2 1 2 3 100000 YES 3 1 1 2 2 3 100000
result:
ok Correct (2 test cases)
Test #30:
score: 0
Accepted
time: 16ms
memory: 3852kb
input:
2 100000 152220344 512661318 556019799 83668874 996378085 712229700 1036676540 1028802593 53835542 979945034 719031251 700014021 328306296 585088538 664491130 957248569 303792317 100184730 944243286 114161574 648100760 14628437 432411982 853239063 861897284 504076024 440547084 1054147326 294492670 2...
output:
YES 3 1 1 2 2 3 100000 YES 3 1 4053 4054 4054 4055 100000
result:
ok Correct (2 test cases)
Test #31:
score: 0
Accepted
time: 19ms
memory: 3848kb
input:
2 100000 0 0 256091592 256091592 256091592 256091592 256091592 256091592 0 256091592 256091592 0 256091592 256091592 256091592 256091592 0 256091592 256091592 0 0 0 0 256091592 0 256091592 256091592 0 0 0 256091592 256091592 256091592 256091592 256091592 256091592 0 0 256091592 256091592 256091592 2...
output:
YES 2 1 2 3 100000 YES 3 1 1 2 2 3 100000
result:
ok Correct (2 test cases)
Test #32:
score: 0
Accepted
time: 36ms
memory: 3604kb
input:
10 20000 0 0 0 611548380 0 0 611548380 611548380 0 0 0 0 0 0 0 0 611548380 0 611548380 611548380 0 611548380 611548380 611548380 611548380 0 0 611548380 0 611548380 0 0 611548380 611548380 611548380 611548380 0 611548380 0 611548380 0 0 0 611548380 611548380 0 611548380 0 0 0 611548380 0 0 611548380...
output:
NO YES 2 1 2 3 20000 NO YES 3 1 1 2 2 3 20000 YES 3 1 1 2 2 3 20000 YES 3 1 1 2 2 3 20000 YES 3 1 1 2 2 3 20000 NO YES 2 1 2 3 20000 YES 2 1 2 3 20000
result:
ok Correct (10 test cases)
Test #33:
score: -100
Wrong Answer
time: 19ms
memory: 3448kb
input:
100 2000 681949331 0 681949331 0 681949331 0 681949331 681949331 0 0 0 0 681949331 0 681949331 0 0 681949331 0 0 0 681949331 0 681949331 0 681949331 681949331 0 681949331 681949331 0 0 0 681949331 0 0 0 0 0 681949331 0 681949331 0 681949331 0 0 0 681949331 681949331 681949331 0 0 681949331 681949331...
output:
NO YES 3 1 1 2 2 3 2000 YES 3 1 1 2 2 3 2000 YES 2 1 2 3 2000 NO YES 3 1 1057 1058 1058 1059 2000 YES 2 1 2 3 2000 YES 2 1 2 3 2000 YES 2 1 2 3 2000 YES 3 1 1 2 2 3 2000 YES 3 1 1230 1231 1231 1232 2000 YES 3 1 888 889 889 890 2000 YES 3 1 381 382 382 383 2000 YES 3 1 1 2 2 3 2000 YES 3 1 1 2 2 3 20...
result:
wrong answer Jury found the answer but participant didn't (test case 1)