QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#71373 | #5120. Power of Two | oc | RE | 261ms | 11104kb | C++14 | 8.8kb | 2023-01-09 21:08:59 | 2023-01-09 21:09:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int c[1<<16];
int n , x,y,z;
int numxor[1<<16];
int numor[1<<16];
int ans[1<<16];
vector<int> A,O,X;
void gen()
{
A.clear();O.clear();X.clear();
for(int i = 0;i <= n - 1;i++) {
// printf("%d , %d %d\n",i,numxor[i],numor[i]);
for(int j = 1;j <= numxor[i];j++) X.push_back(i);
for(int j = 1;j <= numor[i];j++) O.push_back(i);
for(int j = 1;j <= c[i]-numxor[i]-numor[i];j++) A.push_back(i);
}
for(int i = n - 1;i >= 0;i--) {
if(numor[i]) printf("1");
else if(numxor[i] & 1) printf("1");
else printf("0");
}
printf("\n");
for(int i = 1;i <= A.size();i++) printf("&");
for(int i = 1;i <= X.size();i++) printf("^");
for(int i = 1;i <= O.size();i++) printf("|");
printf("\n");
for(int i = 0;i < A.size();i++) printf("%d ",A[i]);
for(auto u : X) printf("%d ",u);
for(auto u : O) printf("%d ",u);
printf("\n");return;
}
struct state
{
int op; ///1 and , 2 xor , 3or
int v;
};
vector<state> v[1<<16];
state q[1<<16];
void gen2()
{
// puts("HERE");
for(int i = 0;i <= n - 1;i++) {
for(int j = 0;j < v[i].size();j++) q[v[i][j].v].op = v[i][j].op , q[v[i][j].v].v = i;
}
int cnt = 0 , cls = 0;
for(int i = 0;i <= n - 1;i++) ans[i] = -1;
for(int i = 1;i <= n;i++) {
if(q[i].op == 1){
if(ans[q[i].v] < cls) ans[q[i].v] = -1;
else ans[q[i].v] = i;
cls = i;
}
else if(q[i].op == 2) {
if(ans[q[i].v] < cls) ans[q[i].v] = i;
else ans[q[i].v] = -1;
}
else {
ans[q[i].v] = i;
}
// printf("i %d , %d %d\n",i,ans[i],cls);
}
for(int i = n - 1;i >= 0;i--) {
if(ans[i] < cls) printf("0");
else printf("1");
}
printf("\n");
for(int i = 1;i <= n;i++) {
if(q[i].op == 1) printf("&");
else if(q[i].op == 2) printf("^");
else printf("|");
}
printf("\n");
for(int i = 1;i <= n;i++) printf("%d ",q[i].v);
printf("\n");return;
}
int num[1<<16] , sum[1<<16];
void solve()
{
scanf("%d%d%d%d",&n,&x,&y,&z);swap(y,z);
for(int i = 0;i < n;i++) c[i] = 0 , numxor[i] = numor[i] = 0 , v[i].clear() , num[i] = sum[i] = 0;
for(int i = 1;i <= n;i++){
int u;scanf("%d",&u);c[u]++;
}
int num = 0;
for(int i = 0;i <= n - 1;i++) num += (c[i] > 0);
if(num >= y + z) {
for(int i = n - 1;i >= 0 && (y || z);i--) {
if(!c[i]) continue;
if(y) {numxor[i]++;y--;}
else {numor[i]++;z--;}
}
gen();return;
}
if(x >= 2) {
int cnt = n , num1 = 2 , pos;
int lstor = 0;
for(int i = 0;i <= n - 1 && (y||z);i++) {
if(!c[i]) continue;
if(y) {v[i].push_back((state){2,cnt--}); y--;}
else {v[i].push_back((state){3,cnt--});z--;lstor = i;}
}
for(int i = 0;i <= n - 1 && num1;i++) {
if(!c[i]) continue;
if(v[i].size() < c[i]) v[i].push_back((state){1 , cnt--}) , x-- , num1-- , pos = i;
}
if(num1 && (z || lstor) && v[pos][0].op == 2) {
if(z) {v[pos][0].op = 3;z--;y++;}
else {
swap(v[pos][0].op , v[lstor][0].op);
}
pos = 0;
}
if(!num1) pos = 0;
for(int i = 0;i <= n - 1 && num1;i++) {
if(!c[i]) continue;
if(v[i].size() < c[i]) v[i].push_back((state){1 , cnt--}) , x-- , num1--;
}
for(int i = 0;i <= n - 1;i++) {
while(v[i].size() < c[i]) {
if(x) v[i].push_back((state){1 , cnt--}) , x--;
else if(y) v[i].push_back((state){2 , cnt--}) , y--;
else v[i].push_back((state){3 , cnt--}) , z--;
}
}
if(pos) {
if(v[pos][0].op != 3) {
int cc = 0 , ftp;
for(int j = 0;j < v[pos].size();j++) {
cc += (v[pos][j].op == 2);
if(v[pos][j].op == 1) ftp = j;
}
if(cc % 2 == 0) {
// puts("IN");
for(int j = 0;j < pos;j++) {
// printf("j %d , %d\n",j,v[j].size());
if(v[j].size()) {
swap(v[j][0].op , v[pos][ftp].op);
int lm = v[j][0].v;
for(int w = 0;w <= n - 1;w++) {
for(auto &kk : v[w]) {
if(kk.v < lm) kk.v++;
}
}
v[j][0].v = 1;
break;
}
}
}
}
}
gen2();return;
}
int ttl = 0;
for(int i = 0;i < n;i++) {
if(c[i]) {ttl += (c[i] - (c[i] % 2 == 0));}
}
if(ttl >= y) {/*
num[0] = (c[0] > 0) , sum[0] = c[0];
for(int i = 1;i <= n - 1;i++) num[i] = num[i - 1] + (c[i] > 0) , sum[i] = sum[i - 1] + c[i];
for(int i = n - 1;i >= 0;i--) {
if(!c[i]) continue;
int d;
if((c[i] - numxor[i]) & 1) d = c[i] - numxor[i] - 1;
else d = c[i] - numxor[i] ;
for(int j = d;j >= 1;j -= 2) {
if()
}
}*/
// puts("IN");
for(int i = n - 1;i >= 0 && y;i--) {
if(c[i]) {numxor[i]++ ; y--;}
}
for(int i = n - 1;i >= 0 && y > 1;i--) {
if((c[i] - numxor[i])) {
int d;
if((c[i] - numxor[i]) & 1) d = c[i] - numxor[i] - 1;
else d = c[i] - numxor[i] ;
numxor[i] += min(d , y - 1);y -= min(d , y - 1);
if(y == 1 && (numxor[i] % 2 == 0) && numxor[i] < c[i]) {
numxor[i]++ ; y--;
}
}
}
if(z){
for(int i = 0;i <= n - 1 && y;i++) {
if(c[i] - numxor[i] > 1) {
y--;numxor[i]++;
}
}
}
for(int i = 0;i <= n - 1 && y;i++) {
if(c[i] - numxor[i] > 0) {
y-- ; numxor[i]++;
if(numxor[i] < c[i]) {
for(int j = 0;j < i;j++) {
if(numxor[j]) {numxor[j]--;numxor[i]++;break;}
}
}
}
}
for(int i = n - 1;i >= 0 && z;i--) {
if(numxor[i] < c[i] && numxor[i] % 2 == 0) {
numor[i]++ ; z--;
}
}
for(int i = n - 1;i >= 0 && z;i--) {
if(numxor[i] + numor[i] < c[i]) {
int d = min(c[i] - numxor[i] - numor[i] , z);
z -= d ; numor[i] += d;
}
}
gen();return;
}
if(x == 1) {
//puts("HERE");
int cnt = n;
for(int i = 0;i <= n - 1;i++) {
if(!c[i]) continue;
if(c[i] & 1) {
y -= c[i] ;
for(int j = 1;j <= c[i];j++) v[i].push_back((state){2 , cnt--});
}
else {
y -= (c[i] - 1);
for(int j = 1;j <= c[i] - 1;j++) v[i].push_back((state){2 , cnt--});
}
}
// printf("cnt %d\n",cnt);
for(int i = 0;i <= n - 1;i++) {
if(v[i].size() < c[i]) {
if(z) v[i].push_back((state){3,cnt--}) , z-- , swap(v[i][v[i].size()-1].v , v[i][0].v);
else if(x) v[i].push_back((state){1 , cnt--}) , x--;
else v[i].push_back((state){2 , cnt--}) , y--;
}
// printf("i %d %d %d\n",i,v[i].size(),c[i]);
}
//printf("cnt %d\n",cnt);
gen2();return;
}
for(int i = 0;i <= n - 1;i++) {
if(!c[i]) continue;
if(c[i] & 1) {
y -= c[i] ; numxor[i] = c[i];
}
else {
y -= (c[i] - 1);numxor[i] = c[i] - 1;
}
}
for(int i = 0;i <= n - 1 && y;i++) {
if(numxor[i] < c[i]) {
numxor[i]++ ; y--;
}
}
for(int i = 0;i <= n - 1 && z ;i++) {
if(numxor[i] < c[i]) {
numor[i]++ ; x--;
}
}
gen();
return;
}
int main() {
// freopen("in.txt","r",stdin);
int t;scanf("%d",&t);/*
if(t == 336) {
int n,x,y,z;
for(int i = 1;i <= 33;i++) {
scanf("%d%d%d%d",&n,&x,&y,&z);
for(int j = 1;j <= n;j++) scanf("%d",&c[j]);
}
printf("%d %d %d %d\n",n,x,y,z);
for(int j = 1;j <= n;j++) printf("%d ",c[j]);return 0;
}*/
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5952kb
input:
4 4 3 0 1 1 0 1 0 4 1 0 3 1 0 1 0 8 0 2 6 1 5 5 7 1 5 5 7 8 0 0 8 1 5 5 7 1 5 5 7
output:
0010 &&&^ 0 0 1 1 0011 ^&^^ 1 0 1 0 10100000 ^^^^^^|| 1 1 5 5 5 7 5 7 00000000 ^^^^^^^^ 1 1 5 5 5 5 7 7
result:
ok ok the answer is correct (4 test cases)
Test #2:
score: 0
Accepted
time: 237ms
memory: 11104kb
input:
16 65511 1 1 65509 42389 52308 9452 29149 28980 48173 38152 51625 29991 48293 12319 38611 47245 11954 45410 33185 30976 56806 18986 35564 25430 48493 26311 19090 42172 33403 62406 15847 51266 33712 53139 15610 50006 62298 28716 19191 3057 35733 12331 14483 9604 16610 18534 32110 35673 5239 31310 279...
output:
011100011111111101111001001110101111111101101101011111011100100111011110101110111110111001110100111101110110111100111101101101111110110101011011111111011111110111000110010000010111011100111101111101111111010001010110100100000110101000001011101011001111110011101111010011101101111010101110011101111110...
result:
ok ok the answer is correct (16 test cases)
Test #3:
score: 0
Accepted
time: 1ms
memory: 5624kb
input:
3 1 0 0 1 0 1 0 1 0 0 1 1 0 0 0
output:
1 ^ 0 1 | 0 0 & 0
result:
ok ok the answer is correct (3 test cases)
Test #4:
score: 0
Accepted
time: 3ms
memory: 5576kb
input:
12 2 0 0 2 0 0 2 0 1 1 0 0 2 0 2 0 0 0 2 1 0 1 0 0 2 1 1 0 0 0 2 2 0 0 0 0 2 0 0 2 0 1 2 0 1 1 0 1 2 0 2 0 0 1 2 1 0 1 0 1 2 1 1 0 0 1 2 2 0 0 0 1
output:
00 ^^ 0 0 01 ^| 0 0 01 || 0 0 01 &^ 0 0 01 &| 0 0 00 && 0 0 11 ^^ 0 1 11 ^| 1 0 11 || 0 1 10 &^ 0 1 10 &| 0 1 00 && 0 1
result:
ok ok the answer is correct (12 test cases)
Test #5:
score: 0
Accepted
time: 3ms
memory: 6088kb
input:
40 3 0 0 3 0 0 0 3 0 1 2 0 0 0 3 0 2 1 0 0 0 3 0 3 0 0 0 0 3 1 0 2 0 0 0 3 1 1 1 0 0 0 3 1 2 0 0 0 0 3 2 0 1 0 0 0 3 2 1 0 0 0 0 3 3 0 0 0 0 0 3 0 0 3 0 1 1 3 0 1 2 0 1 1 3 0 2 1 0 1 1 3 0 3 0 0 1 1 3 1 0 2 0 1 1 3 1 1 1 0 1 1 3 1 2 0 0 1 1 3 2 0 1 0 1 1 3 2 1 0 0 1 1 3 3 0 0 0 1 1 3 0 0 3 0 0 1 3 0...
output:
001 ^^^ 0 0 0 001 ^^| 0 0 0 001 ^|| 0 0 0 001 ||| 0 0 0 000 &^^ 0 0 0 001 &^| 0 0 0 001 &|| 0 0 0 001 &&^ 0 0 0 001 &&| 0 0 0 000 &&& 0 0 0 001 ^^^ 0 1 1 011 ^^| 0 1 1 011 ^|| 1 0 1 011 ||| 0 1 1 011 &^^ 1 0 1 011 &^| 1 1 0 011 &|| 1 0 1 010 &&^ 0 1 1 010 &&| 0 1 1 000 &&& 0 1 1 ...
result:
ok ok the answer is correct (40 test cases)
Test #6:
score: 0
Accepted
time: 3ms
memory: 5784kb
input:
120 4 0 0 4 0 0 0 0 4 0 1 3 0 0 0 0 4 0 2 2 0 0 0 0 4 0 3 1 0 0 0 0 4 0 4 0 0 0 0 0 4 1 0 3 0 0 0 0 4 1 1 2 0 0 0 0 4 1 2 1 0 0 0 0 4 1 3 0 0 0 0 0 4 2 0 2 0 0 0 0 4 2 1 1 0 0 0 0 4 2 2 0 0 0 0 0 4 3 0 1 0 0 0 0 4 3 1 0 0 0 0 0 4 4 0 0 0 0 0 0 4 0 0 4 1 1 0 1 4 0 1 3 1 1 0 1 4 0 2 2 1 1 0 1 4 0 3 1 ...
output:
0000 ^^^^ 0 0 0 0 0001 ^^^| 0 0 0 0 0001 ^^|| 0 0 0 0 0001 ^||| 0 0 0 0 0001 |||| 0 0 0 0 0001 &^^^ 0 0 0 0 0001 &^^| 0 0 0 0 0001 &^|| 0 0 0 0 0001 &||| 0 0 0 0 0000 ^&&^ 0 0 0 0 0001 ^&&| 0 0 0 0 0001 |&&| 0 0 0 0 0001 &&&^ 0 0 0 0 0001 &&&| 0 0 0 0 0000 &&&& 0 0 0 0 0011 ^^^^ 0 1 1...
result:
ok ok the answer is correct (120 test cases)
Test #7:
score: 0
Accepted
time: 1ms
memory: 5676kb
input:
336 5 0 0 5 0 0 0 0 0 5 0 1 4 0 0 0 0 0 5 0 2 3 0 0 0 0 0 5 0 3 2 0 0 0 0 0 5 0 4 1 0 0 0 0 0 5 0 5 0 0 0 0 0 0 5 1 0 4 0 0 0 0 0 5 1 1 3 0 0 0 0 0 5 1 2 2 0 0 0 0 0 5 1 3 1 0 0 0 0 0 5 1 4 0 0 0 0 0 0 5 2 0 3 0 0 0 0 0 5 2 1 2 0 0 0 0 0 5 2 2 1 0 0 0 0 0 5 2 3 0 0 0 0 0 0 5 3 0 2 0 0 0 0 0 5 3 1 1 ...
output:
00001 ^^^^^ 0 0 0 0 0 00001 ^^^^| 0 0 0 0 0 00001 ^^^|| 0 0 0 0 0 00001 ^^||| 0 0 0 0 0 00001 ^|||| 0 0 0 0 0 00001 ||||| 0 0 0 0 0 00000 &^^^^ 0 0 0 0 0 00001 &^^^| 0 0 0 0 0 00001 &^^|| 0 0 0 0 0 00001 &^||| 0 0 0 0 0 00001 &|||| 0 0 0 0 0 00001 ^^&&^ 0 0 0 0 0 00001 ^^&&| 0 0 0 0 0 0...
result:
ok ok the answer is correct (336 test cases)
Test #8:
score: 0
Accepted
time: 0ms
memory: 5632kb
input:
896 6 0 0 6 0 0 0 0 0 0 6 0 1 5 0 0 0 0 0 0 6 0 2 4 0 0 0 0 0 0 6 0 3 3 0 0 0 0 0 0 6 0 4 2 0 0 0 0 0 0 6 0 5 1 0 0 0 0 0 0 6 0 6 0 0 0 0 0 0 0 6 1 0 5 0 0 0 0 0 0 6 1 1 4 0 0 0 0 0 0 6 1 2 3 0 0 0 0 0 0 6 1 3 2 0 0 0 0 0 0 6 1 4 1 0 0 0 0 0 0 6 1 5 0 0 0 0 0 0 0 6 2 0 4 0 0 0 0 0 0 6 2 1 3 0 0 0 0 ...
output:
000000 ^^^^^^ 0 0 0 0 0 0 000001 ^^^^^| 0 0 0 0 0 0 000001 ^^^^|| 0 0 0 0 0 0 000001 ^^^||| 0 0 0 0 0 0 000001 ^^|||| 0 0 0 0 0 0 000001 ^||||| 0 0 0 0 0 0 000001 |||||| 0 0 0 0 0 0 000001 &^^^^^ 0 0 0 0 0 0 000001 &^^^^| 0 0 0 0 0 0 000001 &^^^|| 0 0 0 0 0 0 000001 &^^||| 0 0 0 0 0 0 000...
result:
ok ok the answer is correct (896 test cases)
Test #9:
score: 0
Accepted
time: 7ms
memory: 5652kb
input:
2304 7 0 0 7 0 0 0 0 0 0 0 7 0 1 6 0 0 0 0 0 0 0 7 0 2 5 0 0 0 0 0 0 0 7 0 3 4 0 0 0 0 0 0 0 7 0 4 3 0 0 0 0 0 0 0 7 0 5 2 0 0 0 0 0 0 0 7 0 6 1 0 0 0 0 0 0 0 7 0 7 0 0 0 0 0 0 0 0 7 1 0 6 0 0 0 0 0 0 0 7 1 1 5 0 0 0 0 0 0 0 7 1 2 4 0 0 0 0 0 0 0 7 1 3 3 0 0 0 0 0 0 0 7 1 4 2 0 0 0 0 0 0 0 7 1 5 1 0...
output:
0000001 ^^^^^^^ 0 0 0 0 0 0 0 0000001 ^^^^^^| 0 0 0 0 0 0 0 0000001 ^^^^^|| 0 0 0 0 0 0 0 0000001 ^^^^||| 0 0 0 0 0 0 0 0000001 ^^^|||| 0 0 0 0 0 0 0 0000001 ^^||||| 0 0 0 0 0 0 0 0000001 ^|||||| 0 0 0 0 0 0 0 0000001 ||||||| 0 0 0 0 0 0 0 0000000 &^^^^^^ 0 0 0 0 0 0 0 0000001 &^^^^^| 0 0 0...
result:
ok ok the answer is correct (2304 test cases)
Test #10:
score: 0
Accepted
time: 10ms
memory: 5600kb
input:
5760 8 0 0 8 0 0 0 0 0 0 0 0 8 0 1 7 0 0 0 0 0 0 0 0 8 0 2 6 0 0 0 0 0 0 0 0 8 0 3 5 0 0 0 0 0 0 0 0 8 0 4 4 0 0 0 0 0 0 0 0 8 0 5 3 0 0 0 0 0 0 0 0 8 0 6 2 0 0 0 0 0 0 0 0 8 0 7 1 0 0 0 0 0 0 0 0 8 0 8 0 0 0 0 0 0 0 0 0 8 1 0 7 0 0 0 0 0 0 0 0 8 1 1 6 0 0 0 0 0 0 0 0 8 1 2 5 0 0 0 0 0 0 0 0 8 1 3 4...
output:
00000000 ^^^^^^^^ 0 0 0 0 0 0 0 0 00000001 ^^^^^^^| 0 0 0 0 0 0 0 0 00000001 ^^^^^^|| 0 0 0 0 0 0 0 0 00000001 ^^^^^||| 0 0 0 0 0 0 0 0 00000001 ^^^^|||| 0 0 0 0 0 0 0 0 00000001 ^^^||||| 0 0 0 0 0 0 0 0 00000001 ^^|||||| 0 0 0 0 0 0 0 0 00000001 ^||||||| 0 0 0 0 0 0 0 0 00000001 |||||||| 0 ...
result:
ok ok the answer is correct (5760 test cases)
Test #11:
score: 0
Accepted
time: 30ms
memory: 6296kb
input:
14080 9 0 0 9 0 0 0 0 0 0 0 0 0 9 0 1 8 0 0 0 0 0 0 0 0 0 9 0 2 7 0 0 0 0 0 0 0 0 0 9 0 3 6 0 0 0 0 0 0 0 0 0 9 0 4 5 0 0 0 0 0 0 0 0 0 9 0 5 4 0 0 0 0 0 0 0 0 0 9 0 6 3 0 0 0 0 0 0 0 0 0 9 0 7 2 0 0 0 0 0 0 0 0 0 9 0 8 1 0 0 0 0 0 0 0 0 0 9 0 9 0 0 0 0 0 0 0 0 0 0 9 1 0 8 0 0 0 0 0 0 0 0 0 9 1 1 7 ...
output:
000000001 ^^^^^^^^^ 0 0 0 0 0 0 0 0 0 000000001 ^^^^^^^^| 0 0 0 0 0 0 0 0 0 000000001 ^^^^^^^|| 0 0 0 0 0 0 0 0 0 000000001 ^^^^^^||| 0 0 0 0 0 0 0 0 0 000000001 ^^^^^|||| 0 0 0 0 0 0 0 0 0 000000001 ^^^^||||| 0 0 0 0 0 0 0 0 0 000000001 ^^^|||||| 0 0 0 0 0 0 0 0 0 000000001 ^^||||||| 0 0 0 0...
result:
ok ok the answer is correct (14080 test cases)
Test #12:
score: 0
Accepted
time: 78ms
memory: 5096kb
input:
33792 10 0 0 10 0 0 0 0 0 0 0 0 0 0 10 0 1 9 0 0 0 0 0 0 0 0 0 0 10 0 2 8 0 0 0 0 0 0 0 0 0 0 10 0 3 7 0 0 0 0 0 0 0 0 0 0 10 0 4 6 0 0 0 0 0 0 0 0 0 0 10 0 5 5 0 0 0 0 0 0 0 0 0 0 10 0 6 4 0 0 0 0 0 0 0 0 0 0 10 0 7 3 0 0 0 0 0 0 0 0 0 0 10 0 8 2 0 0 0 0 0 0 0 0 0 0 10 0 9 1 0 0 0 0 0 0 0 0 0 0 10 ...
output:
0000000000 ^^^^^^^^^^ 0 0 0 0 0 0 0 0 0 0 0000000001 ^^^^^^^^^| 0 0 0 0 0 0 0 0 0 0 0000000001 ^^^^^^^^|| 0 0 0 0 0 0 0 0 0 0 0000000001 ^^^^^^^||| 0 0 0 0 0 0 0 0 0 0 0000000001 ^^^^^^|||| 0 0 0 0 0 0 0 0 0 0 0000000001 ^^^^^||||| 0 0 0 0 0 0 0 0 0 0 0000000001 ^^^^|||||| 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok the answer is correct (33792 test cases)
Test #13:
score: 0
Accepted
time: 261ms
memory: 5544kb
input:
65536 16 3 8 5 8 10 13 14 9 12 5 4 13 5 3 14 2 2 5 11 16 4 5 7 2 10 10 4 15 2 14 5 11 12 4 12 5 4 12 11 16 2 0 14 15 3 6 8 5 12 2 2 13 1 4 8 9 1 1 9 16 13 1 2 1 12 9 3 15 10 6 8 13 15 7 12 13 12 3 2 16 2 2 12 3 3 11 10 6 8 6 1 14 2 11 12 2 3 5 2 16 6 3 7 14 12 6 11 7 6 8 13 4 2 4 10 14 4 7 10 16 8 7...
output:
0111111100111100 ||&&&||||||^^^^^ 14 13 5 5 2 14 13 12 11 10 9 8 5 4 3 2 1101110000110100 ||||&&&&|^^^^^^^ 12 12 11 10 5 4 4 2 15 14 12 11 10 5 4 2 1011001101111110 ^^^&&^^^^^^^^^^^ 9 8 1 2 1 15 13 12 9 8 6 5 4 3 2 1 1011000000000000 &&&&&&&&&&&&&^^| 1 2 3 3 6 7 8 9 10 12 12 13 15 13 15 12 01011...
result:
ok ok the answer is correct (65536 test cases)
Test #14:
score: 0
Accepted
time: 235ms
memory: 5840kb
input:
65536 16 6 2 8 2 0 3 7 9 0 1 10 5 5 13 15 5 15 0 1 16 3 1 12 6 12 0 3 0 3 11 1 3 10 14 11 8 12 9 3 16 6 8 2 4 2 11 10 10 2 15 14 8 5 14 10 3 13 7 14 16 11 1 4 8 9 8 0 7 3 13 6 12 4 0 7 4 10 7 13 16 0 14 2 14 1 4 1 3 4 8 1 9 10 10 4 6 10 10 13 16 0 10 6 13 1 3 10 11 9 6 13 1 4 2 1 0 2 2 1 16 0 15 1 5...
output:
1010011010101111 &&&&&&^^^^^^^^|| 0 0 1 5 5 15 2 3 5 7 9 10 13 15 0 1 0101111101001011 |^^&&&^^^^^^^^^^ 12 11 3 3 3 0 14 12 11 10 9 8 6 3 1 0 1110110110111000 &&&&&&^^|||||||| 2 2 10 10 14 14 14 15 3 4 5 7 8 10 11 13 0011011100000000 &&&&&&&&&&&^^^^| 0 0 3 4 4 6 7 7 7 8 13 9 10 12 13 8 011001110...
result:
ok ok the answer is correct (65536 test cases)
Test #15:
score: 0
Accepted
time: 261ms
memory: 5980kb
input:
65536 16 0 10 6 12 5 9 0 8 4 12 0 12 5 7 1 8 12 10 7 16 4 12 0 11 14 5 3 1 3 9 14 12 8 8 9 11 4 6 11 16 2 7 7 10 0 15 13 15 9 11 9 4 9 8 13 12 9 12 2 16 9 0 7 15 6 7 12 14 12 4 3 11 9 9 3 11 8 12 7 16 6 1 9 10 15 12 8 0 0 11 1 3 2 9 12 9 0 0 8 16 10 1 5 13 6 0 8 0 12 4 13 15 6 15 8 2 0 13 8 16 3 10 ...
output:
0001011110110011 ^^^^^^|||||||||| 5 7 8 9 10 12 0 0 1 4 5 7 8 12 12 12 0101101101111010 ||&&&&|||||||||| 14 11 11 9 8 3 14 12 11 9 8 6 5 4 3 1 1011111100010101 ||||&&|||^^^^^^^ 15 13 9 9 12 9 15 13 12 11 10 9 8 4 2 0 1101101110000000 &&&&&&&&&^^^^^^^ 3 3 4 6 7 9 11 12 12 7 8 9 11 12 14 15 100111...
result:
ok ok the answer is correct (65536 test cases)
Test #16:
score: 0
Accepted
time: 253ms
memory: 5092kb
input:
65536 16 14 1 1 5 11 14 9 7 8 8 7 4 4 1 2 11 9 5 13 16 3 2 11 15 0 10 2 2 3 6 11 4 7 2 8 14 13 3 3 16 10 5 1 0 15 4 15 4 15 8 5 0 13 2 0 6 5 1 6 16 8 0 8 5 3 6 8 5 5 11 1 10 15 2 15 2 6 1 1 16 5 11 0 5 14 4 15 13 12 13 1 13 10 8 4 13 7 6 2 16 11 2 3 12 11 14 6 4 0 2 13 12 8 12 15 5 14 7 15 16 3 2 11...
output:
0110000000000000 &&&&&&&&&&&&&&^| 1 2 4 4 5 5 7 7 8 8 9 9 11 11 14 13 1110110111011101 |&&&|^^^^^^^^^^^ 3 2 3 2 15 14 13 11 10 8 7 6 4 3 2 0 1010000101110000 &&&&&&&&&&^||||| 0 0 0 1 2 4 5 6 15 15 15 4 5 6 8 13 1000110101101100 &&&&&&&&^^^^^^^^ 1 1 1 2 5 5 6 15 2 3 5 6 8 10 11 15 111101011111010...
result:
ok ok the answer is correct (65536 test cases)
Test #17:
score: 0
Accepted
time: 250ms
memory: 5908kb
input:
65536 16 1 12 3 15 1 4 2 7 12 3 13 12 4 12 3 14 6 15 4 16 5 10 1 4 1 0 1 3 3 3 8 12 5 12 6 1 5 0 11 16 5 6 5 5 14 9 2 9 6 5 0 11 1 12 2 0 0 6 11 16 6 0 10 12 0 5 4 13 14 2 15 9 4 11 10 9 4 6 12 16 4 6 6 0 12 12 6 10 8 0 1 8 2 7 12 1 13 11 13 16 6 5 5 11 0 11 4 8 3 0 14 9 10 9 6 7 12 2 6 16 1 1 14 12...
output:
1111000011011110 &^^^|||||||||||| 3 13 14 15 1 2 3 4 4 4 6 7 12 12 12 15 0001100101111011 ||&&&&&||||||||^ 12 5 3 3 1 1 0 12 11 8 6 5 4 3 1 0 0101101001100111 ||&&&&&||||^^^^^ 11 9 6 5 0 2 0 14 12 11 9 6 5 2 1 0 1111111001110000 &&&&&&^^^^^^^^^^ 0 2 4 4 9 12 4 5 6 9 10 11 12 13 14 15 00111101110...
result:
ok ok the answer is correct (65536 test cases)
Test #18:
score: 0
Accepted
time: 217ms
memory: 6624kb
input:
16 65520 0 6751 58769 43480 1888 62720 21082 31430 29524 22536 3383 46139 33023 28234 48123 51351 56294 43079 15732 49200 5905 42850 1370 3749 60670 24952 5733 14544 61556 7851 14853 51471 18062 43441 781 9353 40875 55106 42172 51742 23428 32947 53592 26597 43745 34492 2837 59797 22921 55912 1072 57...
output:
101000001011000111010110111010111011110111010011101100010101011001111010110100110101101101111001100011111001101111000110101111111010001101111000001111110110110001110101101010011111001001101101101011101010110110001011010110101000110111111101111010000001111011101111110110011111110011100010101110011111...
result:
ok ok the answer is correct (16 test cases)
Test #19:
score: 0
Accepted
time: 261ms
memory: 10784kb
input:
16 65528 1 1 65526 2118 7289 14627 62109 2001 25915 36313 58067 17825 23775 8479 62169 30810 4240 46927 10308 25924 7076 62131 24116 51951 65272 54431 13867 35431 33756 35215 42165 49686 19717 26301 17431 18671 13821 38170 17575 29633 59607 6231 28629 37301 26802 40650 43099 6959 34139 64105 41557 1...
output:
010110011110110110111101101011110111111001001011101001100101111011011110111110101000010111001111111111000111111111110011011111101110101111111110001111110100100100111110101100001010111111011001111110111101111000111111101110100010111100101100110011011100001101111011101111110011110100101010011111010011...
result:
ok ok the answer is correct (16 test cases)
Test #20:
score: 0
Accepted
time: 206ms
memory: 10320kb
input:
16 65514 1 0 65513 37428 31502 64622 39894 3203 48386 3336 35126 55206 15129 65316 46648 8425 40771 47552 42979 41619 21384 35079 56830 47895 61333 48552 53708 35032 45422 31555 58163 19041 46435 41096 19443 3863 63846 5864 65094 24647 48114 44084 17984 60680 2843 49943 4889 63070 27777 35249 14332 ...
output:
010011111110111101001010110101110001011011011100100111100110111000010011011101111111011111110101101111011111011100111111110000101111110110010000001111010101011111110111111111101011001011000110111111110001110010111111111101111001101111011100101010111011101111100111010011001001101000111011110100011100...
result:
ok ok the answer is correct (16 test cases)
Test #21:
score: -100
Runtime Error
input:
16 65522 2 0 65520 46149 56944 35632 5001 64090 21231 37083 29772 53754 46341 361 42022 57496 62257 50349 12702 22047 51356 58774 14065 55242 20212 12530 47369 15293 12386 28496 40083 28215 56647 21233 30468 48111 26462 13702 52011 12965 43748 37047 58016 44345 56816 20285 55099 26829 5143 23543 549...
output:
101110001101010111100110111000101111010101111011000110110101001101101011111110101100010110101010110011001100101111001111110111011101010101011011100111011011111110011010001100111111110111111001011110111111111010111011000100111111100010101111110101110011001111001101011011101100011101111001111111000100...