QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#402045 | #7411. Bitwise Xor | IBory | AC ✓ | 401ms | 408032kb | C++17 | 1.5kb | 2024-04-29 19:57:36 | 2024-04-29 19:57:37 |
Judging History
answer
#include <bits/stdc++.h>
#define pii pair<ll, ll>
typedef long long ll;
using namespace std;
const ll MAX = 300007, MOD = 998244353;
struct Trie {
ll cnt;
Trie* C[2];
Trie() {
cnt = 0;
C[0] = C[1] = nullptr;
}
void Update(ll n, ll bit) {
cnt++;
if (bit < 0) return;
int t = (n & (1LL << bit)) > 0;
if (!C[t]) C[t] = new Trie;
C[t]->Update(n, bit - 1);
}
ll Query(ll n, ll k, ll bit) {
int a = (n & (1LL << bit)) > 0;
int b = (k & (1LL << bit)) > 0;
ll ret = 0;
if (b && C[a]) ret += C[a]->cnt;
if (C[a ^ b]) ret += C[a ^ b]->Query(n, k, bit - 1);
return ret;
}
} R;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
ll N, X;
cin >> N >> X;
if (!X) {
ll t = 1;
while (N--) t = t * 2 % MOD;
cout << t - 1;
return 0;
}
ll ans = 1, mask = 1;
while ((mask & X) != X) mask = mask * 2LL + 1;
map<ll, vector<ll>> go;
while (N--) {
ll n;
cin >> n;
ll base = (n | mask) ^ mask;
go[base].push_back(n & mask);
}
for (auto& [_, v] : go) {
ll ret = 1LL + v.size(), two = 1LL * v.size() * v.size(), temp = 0;
// pick two, whose xor cnt greater or equal than X
//for (int i = 0; i < v.size(); ++i) for (int j = i + 1; j < v.size(); ++j) {
// if (X <= (v[i] ^ v[j])) temp++;
//}
Trie R;
for (ll n : v) R.Update(n, 59);
for (ll n : v) two -= R.Query(n, X, 59);
ret = (ret + two / 2LL) % MOD;
ans = ans * ret % MOD;
}
ans = (ans + MOD - 1) % MOD;
cout << ans;
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
3 0 0 1 2
output:
7
result:
ok 1 number(s): "7"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
3 2 0 1 2
output:
5
result:
ok 1 number(s): "5"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 3 0 1 2
output:
4
result:
ok 1 number(s): "4"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
7 4 11 5 5 8 3 1 3
output:
35
result:
ok 1 number(s): "35"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
10 0 1 1 0 0 1 0 0 0 1 1
output:
1023
result:
ok 1 number(s): "1023"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
10 0 1 1 0 1 0 1 1 0 1 0
output:
1023
result:
ok 1 number(s): "1023"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
10 1 1 0 0 1 0 0 0 0 0 0
output:
26
result:
ok 1 number(s): "26"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
10 0 0 0 1 1 0 1 1 1 1 1
output:
1023
result:
ok 1 number(s): "1023"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
10 1 0 0 0 0 0 1 1 0 0 1
output:
31
result:
ok 1 number(s): "31"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
10 2 3 3 3 0 3 1 2 2 1 2
output:
31
result:
ok 1 number(s): "31"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
10 0 2 1 1 1 1 2 0 1 2 0
output:
1023
result:
ok 1 number(s): "1023"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
10 1 2 2 2 3 2 3 3 1 2 3
output:
59
result:
ok 1 number(s): "59"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
10 0 0 0 0 1 1 1 0 2 3 2
output:
1023
result:
ok 1 number(s): "1023"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
10 3 0 2 2 2 1 2 3 0 2 1
output:
22
result:
ok 1 number(s): "22"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
10 232612786 899206785 627708234 142071418 602920154 868777585 1041571266 892732172 868993257 746093759 987356899
output:
109
result:
ok 1 number(s): "109"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
10 0 693036642 1030693062 419968059 741209191 591827389 259645735 276712455 734217910 177798129 94619093
output:
1023
result:
ok 1 number(s): "1023"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10 635603548 611293890 811243506 517958533 561419149 895889603 689314144 76814806 428189482 659398653 905893003
output:
28
result:
ok 1 number(s): "28"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
10 598501421 901133473 1042356871 455409245 112433974 817368410 222953949 336845301 1006948209 370826440 272138888
output:
32
result:
ok 1 number(s): "32"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10 569445936 869711746 277315301 943789204 430971232 323814634 798129975 683685773 693506183 425568840 820399918
output:
30
result:
ok 1 number(s): "30"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10 420556732312880218 1106881251557229935 479315094315300787 1150808909500812292 323682577963266475 778601139147884850 223606994709920530 180162865619996357 598163543343955050 759543442386927924 1066745884923649787
output:
76
result:
ok 1 number(s): "76"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10 582978699259358148 664286799112260583 224369278625040035 902797719937094060 670944402692952440 328843827154205288 428706657140951701 137252770966221528 52751604837394452 252242163219108700 964286128123886602
output:
34
result:
ok 1 number(s): "34"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
10 564992503452356335 665113046585311303 966441243412282831 254418450103486710 373213599504887965 373018025659128173 1139839833176769230 63170343788559154 552084482604372812 578369479665175584 290676303796380178
output:
34
result:
ok 1 number(s): "34"
Test #23:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
10 296378574821992743 46426013340785518 543133517958628320 4427845211879112 131398175764325177 79046368751109655 1033217350714129300 958341202565114446 639852945691905735 340024558340731405 274343413834503372
output:
107
result:
ok 1 number(s): "107"
Test #24:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10 753648817744708845 679105509954532975 932747575918656348 715747811344168398 279517138768023690 391618536155396132 543057934603808659 157236874656623091 259985351735488895 1139457402033766834 939468151234428243
output:
30
result:
ok 1 number(s): "30"
Test #25:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
2000 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 1 0 0...
output:
708964704
result:
ok 1 number(s): "708964704"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2000 0 0 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 1 0 0...
output:
708964704
result:
ok 1 number(s): "708964704"
Test #27:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
2000 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0...
output:
1000976
result:
ok 1 number(s): "1000976"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2000 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1...
output:
708964704
result:
ok 1 number(s): "708964704"
Test #29:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
2000 1 1 1 0 0 1 1 0 1 1 0 0 0 0 1 0 0 0 0 1 1 1 1 0 1 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 0 0 0 0 1 1 1 0 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1...
output:
1001975
result:
ok 1 number(s): "1001975"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
2000 2 1 3 2 0 1 3 1 3 3 2 2 2 3 3 1 3 3 3 0 1 3 2 0 2 1 1 1 3 2 2 1 3 3 0 2 0 1 0 3 0 1 1 3 2 1 1 2 3 1 1 2 1 3 1 0 3 0 1 0 2 0 1 1 2 2 2 2 3 1 0 2 1 0 2 1 0 3 0 0 0 0 0 1 3 3 1 1 2 3 3 0 0 2 2 0 2 1 3 3 0 1 1 0 3 3 1 2 1 2 3 2 0 3 2 0 3 0 0 1 3 2 3 0 0 1 1 0 1 0 2 0 3 2 1 3 3 3 3 0 0 0 3 0 2 3 2 3...
output:
1001964
result:
ok 1 number(s): "1001964"
Test #31:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
2000 2 3 0 2 3 1 3 3 0 2 3 0 0 0 0 1 3 3 1 0 3 2 2 0 3 1 2 3 3 1 1 1 2 0 3 2 0 0 3 0 1 1 0 2 0 0 0 3 0 0 0 1 3 1 2 2 2 0 3 3 2 0 1 0 2 0 2 1 3 3 3 0 2 3 3 0 2 3 1 3 3 0 1 2 0 3 3 0 2 2 2 2 3 3 3 2 0 0 0 3 3 1 1 3 1 1 2 1 1 0 3 0 0 0 3 2 3 1 1 1 0 3 2 1 1 0 1 0 3 3 2 1 0 3 0 1 2 1 3 2 2 2 2 3 1 2 2 1...
output:
1001984
result:
ok 1 number(s): "1001984"
Test #32:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
2000 3 3 0 0 1 2 0 2 0 1 2 3 3 3 1 0 0 2 3 2 0 2 3 1 2 2 2 0 0 2 3 3 0 3 3 3 1 2 1 1 3 1 3 3 3 1 3 2 0 2 3 3 3 2 2 2 0 3 0 2 3 0 2 3 0 0 0 2 3 2 1 1 1 2 2 0 0 3 0 1 3 3 1 0 0 2 3 0 1 3 1 0 3 2 0 3 2 0 3 1 3 2 3 0 0 3 0 0 0 1 2 3 1 0 1 2 0 3 2 1 0 0 0 3 2 0 3 0 2 1 0 1 2 3 3 0 2 0 0 1 2 0 3 2 0 1 0 0...
output:
500878
result:
ok 1 number(s): "500878"
Test #33:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2000 0 3 2 1 1 2 1 3 2 2 0 2 0 0 0 0 1 1 1 2 1 3 3 2 3 1 2 0 0 2 3 2 0 3 1 3 3 0 1 0 1 3 2 2 3 1 2 1 0 3 3 0 0 3 3 3 0 0 0 0 0 1 1 2 0 3 3 1 3 2 0 0 3 1 0 2 0 3 3 2 0 2 0 3 1 3 1 0 3 0 1 0 2 1 0 3 1 0 3 0 2 1 2 1 0 2 3 2 3 0 2 3 3 0 3 1 1 0 2 1 0 0 3 1 2 1 2 0 1 0 1 2 3 0 1 2 2 0 1 3 0 2 3 0 0 3 0 0...
output:
708964704
result:
ok 1 number(s): "708964704"
Test #34:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
2000 3 1 3 0 2 2 0 2 1 0 0 2 1 0 0 1 1 3 2 0 2 2 0 2 0 3 1 1 3 3 2 1 3 3 2 0 1 0 3 3 0 2 3 0 0 0 0 2 2 2 0 1 2 2 2 3 0 0 3 3 0 2 2 2 2 1 0 1 2 1 0 0 1 1 0 3 2 1 3 0 2 2 1 2 0 2 2 0 2 1 3 2 3 1 3 3 2 3 0 2 1 0 3 2 0 0 0 2 2 2 3 1 0 3 0 3 1 2 0 2 2 2 2 2 0 0 3 1 1 1 2 3 3 2 1 0 2 0 2 1 0 0 3 3 0 3 2 0...
output:
501086
result:
ok 1 number(s): "501086"
Test #35:
score: 0
Accepted
time: 2ms
memory: 4884kb
input:
2000 84871189 1045107888 457736159 1040100608 728197221 258193066 35582589 511446583 980507876 434393762 889926277 6565983 1021327134 336189598 429390370 200222928 242627553 850085482 8999142 911979240 917229471 610016276 797660227 1047817351 531797743 767090800 700551186 953164435 265389835 1007662...
output:
898802445
result:
ok 1 number(s): "898802445"
Test #36:
score: 0
Accepted
time: 2ms
memory: 4888kb
input:
2000 951504201 620557932 850267211 176974794 744535683 632583510 843330442 529006451 709017771 639018779 134814560 120610907 658919140 437817344 413288199 300190866 118111296 495762049 760171784 662091678 654628965 934431180 810642884 160040182 809395723 430169155 222263790 217911944 1030547842 9753...
output:
229324
result:
ok 1 number(s): "229324"
Test #37:
score: 0
Accepted
time: 0ms
memory: 4784kb
input:
2000 788229967 538815180 630817655 274965267 564745641 936645724 199257026 329108802 402989343 46877478 946088471 760445490 481263012 807924123 1001370952 171192357 30476077 326474988 864239246 193744992 1073108566 882960785 221485574 712766380 1009610971 678404036 811480879 863819478 489736735 4892...
output:
534095
result:
ok 1 number(s): "534095"
Test #38:
score: 0
Accepted
time: 0ms
memory: 4884kb
input:
2000 665904370 720707622 799363605 458735737 153190095 327311293 475247944 311645162 394427035 411021907 848970130 225182950 321153936 226791347 1009972145 47573674 398010415 124711848 460068359 924933300 1070303963 566647429 245289242 960575303 893291101 701615518 683101204 333787114 208069217 7499...
output:
758288
result:
ok 1 number(s): "758288"
Test #39:
score: 0
Accepted
time: 0ms
memory: 4788kb
input:
2000 155206429 1015612849 107343227 768076570 556248299 786971940 865883122 302400184 805020802 113868843 722969295 579681659 867847988 613723351 386570839 310146404 336197514 871605822 91107700 216159676 120677616 180646135 1047283252 23297933 1017975862 612523938 775937610 62537255 855834639 20082...
output:
138392029
result:
ok 1 number(s): "138392029"
Test #40:
score: 0
Accepted
time: 3ms
memory: 6708kb
input:
2000 810644317790559450 951234409297480605 917050945953463382 1110412530216095289 5030990046961552 411205681829833188 765404220932245053 126045976080458432 435705840272855629 845862553616946390 1152560042560800764 567645952714623247 360729381676462789 848159168753584687 519933674668600749 2540037923...
output:
594689
result:
ok 1 number(s): "594689"
Test #41:
score: 0
Accepted
time: 3ms
memory: 6788kb
input:
2000 158540740765130049 307188828836158449 537689509214794280 537785471236196666 293604397655495572 597874280046861825 270407892057038072 932847932947767503 471369711173545165 292227431482774334 563299190758435994 339610138601354163 722608135348476612 440094441170088384 158591217241198356 3953759389...
output:
212011211
result:
ok 1 number(s): "212011211"
Test #42:
score: 0
Accepted
time: 3ms
memory: 6716kb
input:
2000 281895081539402771 308015067719274577 126839973690157396 1042327706009436292 1148795094779310777 642048482846752006 981541072387822896 208669118250151582 886201418516729153 817845297720620873 588936810039543409 629031346871575155 594627493917270017 500735062829469932 375517603768807021 80051925...
output:
928207213
result:
ok 1 number(s): "928207213"
Test #43:
score: 0
Accepted
time: 0ms
memory: 6704kb
input:
2000 1048281954270496219 1079369157737891331 954948102282751878 812163970851284857 999050589029779754 276896950225917604 413163304663465996 119771664162727614 288970558113644506 868270077720013237 1003763159329372780 888201456984216696 65034312731365865 901955073953037506 1073103323217772014 2974098...
output:
183415
result:
ok 1 number(s): "183415"
Test #44:
score: 0
Accepted
time: 0ms
memory: 6824kb
input:
2000 53809885318283364 523458659104849054 545286009975958001 193923746933083219 479141635726995550 401902225446076259 1084855165121100478 714023893466016350 1147700676192370646 346304454375572768 811094623237592343 303366583942144293 803498991796487934 530493941791779428 971086450897451585 230129538...
output:
855514808
result:
ok 1 number(s): "855514808"
Test #45:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
300000 0 1 1 0 0 0 0 1 1 1 0 1 0 1 0 0 1 1 1 0 0 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 0 1 0 0 1 1 0 0 1 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 1 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 0...
output:
526952119
result:
ok 1 number(s): "526952119"
Test #46:
score: 0
Accepted
time: 56ms
memory: 7908kb
input:
300000 1 1 0 0 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1 1 0 1 0 1 1 1 0 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 1 0 0 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0 1 0...
output:
538924198
result:
ok 1 number(s): "538924198"
Test #47:
score: 0
Accepted
time: 52ms
memory: 8812kb
input:
300000 1 1 0 1 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 0 0...
output:
538892905
result:
ok 1 number(s): "538892905"
Test #48:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
300000 0 1 1 1 1 1 0 0 1 0 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 0...
output:
526952119
result:
ok 1 number(s): "526952119"
Test #49:
score: 0
Accepted
time: 56ms
memory: 7564kb
input:
300000 1 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 1 0 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 1 0 1 1...
output:
538906278
result:
ok 1 number(s): "538906278"
Test #50:
score: 0
Accepted
time: 55ms
memory: 8232kb
input:
300000 2 1 1 0 2 2 2 3 0 1 3 0 0 2 3 1 1 1 3 1 2 0 1 1 3 3 3 2 0 3 1 1 0 0 1 1 3 3 2 1 0 1 1 3 0 1 3 3 1 2 3 2 0 3 1 3 0 1 3 1 0 1 0 2 1 2 3 2 1 3 1 2 1 0 1 2 1 0 1 3 3 2 3 2 3 1 2 3 1 2 1 3 1 1 0 3 3 0 3 2 1 3 0 2 0 2 1 3 3 3 0 3 1 1 1 1 3 2 0 3 0 1 0 0 0 1 1 2 2 1 3 1 2 1 1 2 3 0 3 0 2 0 0 3 1 3 0...
output:
538921098
result:
ok 1 number(s): "538921098"
Test #51:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
300000 0 0 2 0 1 3 1 3 0 2 0 3 3 3 2 3 2 1 3 1 3 1 2 0 2 2 1 3 1 2 1 0 1 2 3 3 0 2 3 3 1 2 1 0 3 2 3 0 2 3 0 1 0 0 1 0 1 2 3 2 3 0 1 1 3 3 0 0 3 3 2 0 2 1 2 0 3 3 0 2 2 3 2 3 1 0 3 3 0 3 0 2 1 0 2 1 1 3 2 3 2 3 1 0 3 2 0 2 3 2 1 3 2 2 3 3 2 3 3 0 3 3 2 1 0 2 3 3 0 0 3 0 1 0 0 3 1 1 2 2 3 3 2 1 3 2 1...
output:
526952119
result:
ok 1 number(s): "526952119"
Test #52:
score: 0
Accepted
time: 53ms
memory: 6328kb
input:
300000 1 0 2 2 3 0 2 2 0 1 2 2 3 2 0 2 3 0 2 3 0 2 0 1 1 3 2 0 2 2 3 2 0 1 3 3 0 0 2 0 0 3 3 1 1 3 2 3 2 1 3 3 3 1 1 0 3 1 3 1 3 3 2 1 1 3 1 1 2 2 0 1 0 0 2 3 1 3 3 3 2 2 2 1 0 3 3 3 3 1 3 0 2 3 3 2 0 3 1 1 2 0 3 2 2 0 2 0 2 3 0 2 3 2 2 3 3 0 3 1 3 1 3 3 1 2 1 3 3 2 2 1 3 1 0 1 1 3 3 1 0 1 3 0 1 1 3...
output:
355197415
result:
ok 1 number(s): "355197415"
Test #53:
score: 0
Accepted
time: 2ms
memory: 3612kb
input:
300000 0 1 3 3 3 0 1 3 2 3 3 1 3 2 2 0 3 0 2 2 1 3 3 2 0 1 3 2 1 2 3 1 3 3 2 2 1 1 0 0 3 0 0 0 1 0 3 2 2 0 3 1 3 2 1 2 2 0 3 1 3 2 3 3 3 1 1 1 3 1 1 0 1 0 3 3 0 2 1 0 3 3 1 3 2 0 0 1 1 2 1 2 3 1 3 1 0 2 2 3 3 1 3 3 1 0 3 0 0 2 1 1 1 1 1 0 3 1 1 0 1 3 3 0 0 3 1 1 2 2 0 0 0 0 2 1 1 3 1 1 1 2 1 1 0 3 2...
output:
526952119
result:
ok 1 number(s): "526952119"
Test #54:
score: 0
Accepted
time: 51ms
memory: 8812kb
input:
300000 3 2 0 2 0 0 3 1 3 2 1 0 3 3 0 1 3 1 2 1 3 0 3 3 1 2 2 2 0 1 0 0 0 0 0 0 3 2 1 1 3 2 0 0 2 1 3 2 1 3 2 0 1 2 2 2 1 1 1 0 1 3 0 3 1 2 1 1 0 0 1 1 1 1 3 0 2 2 3 3 0 0 0 2 1 0 3 3 1 0 1 1 0 0 1 2 3 2 0 1 2 1 2 0 1 3 0 3 0 3 0 3 1 0 3 0 1 0 0 0 3 2 3 2 0 0 3 3 2 2 3 0 2 1 1 2 1 1 2 1 2 3 3 2 2 3 0...
output:
269609889
result:
ok 1 number(s): "269609889"
Test #55:
score: 0
Accepted
time: 237ms
memory: 126572kb
input:
300000 492151004 648841878 687396117 622028958 706072444 635954520 185209069 208924095 974461408 1042239242 766620568 796047134 341157817 509986884 1052564765 969815068 252243431 145822160 704350935 848749451 86196191 387317548 171404790 634277431 240750125 206346507 146739711 872075610 413693164 44...
output:
7270165
result:
ok 1 number(s): "7270165"
Test #56:
score: 0
Accepted
time: 220ms
memory: 126804kb
input:
300000 356285983 923984336 732880140 624477052 679161025 930155344 351556000 332366985 352747709 153235329 929621778 624807253 100095943 336921032 855775923 352661350 334339874 483553772 517215960 511597286 997670230 968578202 938528603 494456612 729052845 371366882 492711448 871373585 16015799 2059...
output:
408586955
result:
ok 1 number(s): "408586955"
Test #57:
score: 0
Accepted
time: 278ms
memory: 126712kb
input:
300000 855751417 842241584 513430585 722467525 499370982 160475734 781224409 132469336 46719281 634835852 667153864 190900013 996181638 707027810 370116852 223662841 246704655 314266710 621283422 43250601 342408006 917107806 349371293 1047182809 929268092 619601763 8186712 443539294 548946515 597608...
output:
151851457
result:
ok 1 number(s): "151851457"
Test #58:
score: 0
Accepted
time: 261ms
memory: 126588kb
input:
300000 440099076 603320551 173124039 393361079 450761929 909278675 278608479 1029116924 982385409 132087301 279424653 740101577 220257624 669279071 1062442629 263802252 385802138 955497848 309573967 194232741 30709161 694533148 579705671 880232424 834488828 972063176 262821021 392996895 316458011 52...
output:
542333258
result:
ok 1 number(s): "542333258"
Test #59:
score: 0
Accepted
time: 247ms
memory: 126640kb
input:
300000 489581766 619346839 337003184 350004920 534123522 90991569 1015509602 1073619521 798974334 721714323 599663586 295420986 187678671 787520637 1009745233 5996720 345813392 167342500 786459493 152929888 363386160 1031689232 421027816 683499837 726928243 51779646 222126135 1055190253 1004137968 3...
output:
282934833
result:
ok 1 number(s): "282934833"
Test #60:
score: 0
Accepted
time: 375ms
memory: 407852kb
input:
300000 296755831871074694 449916145255809411 664964133945233804 918494807762995671 1017561483435607718 1050236328754223250 975976930536111197 343124186064496069 513883346116829116 545415329069780661 246855046099834345 1082391952528494267 520503778960718250 144056201686753900 645472815426907434 71835...
output:
250889392
result:
ok 1 number(s): "250889392"
Test #61:
score: 0
Accepted
time: 357ms
memory: 407916kb
input:
300000 522904573777542368 962414065413867349 839636238044791529 1030976476089065709 548723867982105041 550361682447545338 1081644432580000526 101246847252080101 974629122513071327 888209748373157017 298502197480085908 882086499907370133 414877156946824331 813321273511839084 239322167113172577 179241...
output:
752091275
result:
ok 1 number(s): "752091275"
Test #62:
score: 0
Accepted
time: 401ms
memory: 407940kb
input:
300000 718691082336988666 963240308591950774 428786702520154646 382597201960491062 250993064794040567 594535885247435520 639856112598905671 236539320954441043 804860607150423983 926643884655461199 324139812466226028 18586199275776853 207762814491471398 967854326259020717 686070377094919104 875282634...
output:
976936805
result:
ok 1 number(s): "976936805"
Test #63:
score: 0
Accepted
time: 356ms
memory: 408032kb
input:
300000 464807235053729216 228394377666074308 295217602528773944 1077126983236785096 764651373251968371 657365624945895233 598217369137077179 916422716002992158 106786973592530724 441387283112315787 165825282209692364 257824930124214936 387540365374728219 224068482769309208 1073536771249665868 564799...
output:
928004133
result:
ok 1 number(s): "928004133"
Test #64:
score: 0
Accepted
time: 400ms
memory: 407832kb
input:
300000 895822183904582964 22140399358145156 293199197967728423 2006028774950897 146269716997786412 1118172282651385611 498746156429483475 662575125958384199 1101861263502387035 104488660382448702 900218455760274995 256224410188239297 586825807511811748 327807588465102174 1083765959133431180 69447687...
output:
52793764
result:
ok 1 number(s): "52793764"
Test #65:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 0 0
output:
1
result:
ok 1 number(s): "1"
Test #66:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
1 228 1152921504606846975
output:
1
result:
ok 1 number(s): "1"