QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#522488 | #7411. Bitwise Xor | cyx | RE | 99ms | 58972kb | C++23 | 4.0kb | 2024-08-17 00:12:21 | 2024-08-17 00:12:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define getchar() p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++
char buf[1000000], *p1 = buf, *p2 = buf;
template <typename T>
void read(T &x)
{
x = 0;
int f = 1;
char c = getchar();
for (; c < '0' || c > '9'; c = getchar())
if (c == '-')
f = -f;
for (; c >= '0' && c <= '9'; c = getchar())
x = x * 10 + c - '0';
x *= f;
}
template <typename T, typename... Args>
void read(T &x, Args &...y)
{
read(x);
read(y...);
}
typedef long long ll;
template <int P>
class mod_int
{
using Z = mod_int;
private:
static int mo(int x) { return x < 0 ? x + P : x; }
public:
int x;
int val() const { return x; }
mod_int() : x(0) {}
template <class T>
mod_int(const T &x_) : x(x_ >= 0 && x_ < P ? static_cast<int>(x_) : mo(static_cast<int>(x_ % P))) {}
bool operator==(const Z &rhs) const { return x == rhs.x; }
bool operator!=(const Z &rhs) const { return x != rhs.x; }
Z operator-() const { return Z(x ? P - x : 0); }
Z pow(long long k) const
{
Z res = 1, t = *this;
while (k)
{
if (k & 1)
res *= t;
if (k >>= 1)
t *= t;
}
return res;
}
Z &operator++()
{
x < P - 1 ? ++x : x = 0;
return *this;
}
Z &operator--()
{
x ? --x : x = P - 1;
return *this;
}
Z operator++(int)
{
Z ret = x;
x < P - 1 ? ++x : x = 0;
return ret;
}
Z operator--(int)
{
Z ret = x;
x ? --x : x = P - 1;
return ret;
}
Z inv() const { return pow(P - 2); }
Z &operator+=(const Z &rhs)
{
(x += rhs.x) >= P && (x -= P);
return *this;
}
Z &operator-=(const Z &rhs)
{
(x -= rhs.x) < 0 && (x += P);
return *this;
}
Z operator-() { return -x; }
Z &operator*=(const Z &rhs)
{
x = 1ULL * x * rhs.x % P;
return *this;
}
Z &operator/=(const Z &rhs) { return *this *= rhs.inv(); }
#define setO(T, o) \
friend T operator o(const Z &lhs, const Z &rhs) \
{ \
Z res = lhs; \
return res o## = rhs; \
}
setO(Z, +) setO(Z, -) setO(Z, *) setO(Z, /)
#undef setO
friend istream &
operator>>(istream &is, mod_int &x)
{
long long tmp;
is >> tmp;
x = tmp;
return is;
}
friend ostream &operator<<(ostream &os, const mod_int &x)
{
os << x.val();
return os;
}
};
using Z = mod_int<998244353>;
int n;
ll x;
ll a[300020];
Z f[300020];
Z ans;
struct Trie
{
int c[4800020][2];
Z val[4800020];
int cnt = 0;
void insert(ll x, ll y)
{
int u = 0;
for (int i = 59; i >= 0; i--)
{
int t = x >> i & 1;
if (!c[u][t])
c[u][t] = ++cnt;
u = c[u][t];
val[u] += y;
}
}
Z query(ll x, ll y)
{
int u = 0;
Z ans = 0;
for (int i = 59; i >= 0; i--)
{
int t = y >> i & 1;
if (x >> i & 1)
{
if (!c[u][!t])
return ans;
u = c[u][!t];
continue;
}
ans += val[c[u][!t]];
if (!c[u][t])
return ans;
u = c[u][t];
}
return ans + val[u];
}
} T;
int main()
{
read(n, x);
for (int i = 1; i <= n; i++)
read(a[i]);
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; i++)
{
f[i] = T.query(x, a[i]) + 1;
ans += f[i];
T.insert(a[i], f[i].val());
}
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 28304kb
input:
3 0 0 1 2
output:
7
result:
ok 1 number(s): "7"
Test #2:
score: 0
Accepted
time: 3ms
memory: 26112kb
input:
3 2 0 1 2
output:
5
result:
ok 1 number(s): "5"
Test #3:
score: 0
Accepted
time: 0ms
memory: 28244kb
input:
3 3 0 1 2
output:
4
result:
ok 1 number(s): "4"
Test #4:
score: 0
Accepted
time: 0ms
memory: 28260kb
input:
7 4 11 5 5 8 3 1 3
output:
35
result:
ok 1 number(s): "35"
Test #5:
score: 0
Accepted
time: 3ms
memory: 26196kb
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: 3ms
memory: 24132kb
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: 28216kb
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: 3ms
memory: 26200kb
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: 28216kb
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: 26176kb
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: 2ms
memory: 28288kb
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: 2ms
memory: 26168kb
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: 4ms
memory: 26172kb
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: 26244kb
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: 5ms
memory: 28228kb
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: 26256kb
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: 26244kb
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: 28164kb
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: 4ms
memory: 28308kb
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: 26196kb
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: 2ms
memory: 26268kb
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: 26124kb
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: 26180kb
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: 28292kb
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: 26136kb
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: 3ms
memory: 26244kb
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: 3ms
memory: 28160kb
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: 26192kb
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: 3ms
memory: 24084kb
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: 26176kb
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: 0ms
memory: 26192kb
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: 0ms
memory: 28188kb
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: 26188kb
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: 0ms
memory: 26176kb
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: 4ms
memory: 26508kb
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: 0ms
memory: 26520kb
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: 24468kb
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: 2ms
memory: 28480kb
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: 2ms
memory: 26452kb
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: 0ms
memory: 26944kb
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: 0ms
memory: 27068kb
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: 0ms
memory: 28936kb
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: 2ms
memory: 29060kb
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: 2ms
memory: 28924kb
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: 78ms
memory: 27348kb
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: 80ms
memory: 27724kb
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: 77ms
memory: 28556kb
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: 78ms
memory: 28376kb
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: 77ms
memory: 27368kb
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: 74ms
memory: 27584kb
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: 79ms
memory: 26932kb
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: 77ms
memory: 28408kb
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: 79ms
memory: 26792kb
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: 73ms
memory: 27776kb
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: 76ms
memory: 58192kb
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: 87ms
memory: 57488kb
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: 84ms
memory: 58516kb
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: 99ms
memory: 57820kb
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: 93ms
memory: 58972kb
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: -100
Runtime Error
input:
300000 296755831871074694 449916145255809411 664964133945233804 918494807762995671 1017561483435607718 1050236328754223250 975976930536111197 343124186064496069 513883346116829116 545415329069780661 246855046099834345 1082391952528494267 520503778960718250 144056201686753900 645472815426907434 71835...