QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#570029 | #4327. Šeširi | Williamxzh | 0 | 171ms | 182436kb | C++23 | 1.3kb | 2024-09-17 13:20:24 | 2024-09-17 13:20:24 |
Judging History
answer
//translated from Izborne Pripreme 2022 (Croatian IOI/CEOI Team Selection) D1T3. 3s,0.5G
//like little circle!
//ad-hoc
//little circle loves Eulerian circuit
#include <bits/stdc++.h>
#define il inline
using namespace std;
const int N=(1<<23),M=(1<<19)+5;
int n,S,fi[N],in[M];
bitset<N> vis,c;
int head[M],tot=1;
struct node{
int to,nxt;
il node(){to=nxt=0;}
}e[N];
il void add(int x,int y){e[++tot].to=y,e[tot].nxt=head[x],head[x]=tot;}
il void adde(int x,int y){add(x,y),add(y,x);}
void dfs(int x){
int y;
for(int &i=head[x];i;i=e[i].nxt){
y=e[i].to;
if(!vis[i>>1]) vis[i>>1]=1,c[i>>1]=(x>=S),dfs(y);
}
}
int x,y,z,u,v,w;
int main(){
scanf("%d",&n);S=(1<<n);
for(int i=0;i<S;++i){
for(int j=0;j<n;++j){
if((i>>j)&1) continue;
adde(i,(i|(1<<j))+S),++in[i],++in[(i|(1<<j))+S];
}
}
for(int i=0;i<(S<<1);++i) if(in[i]&1) adde(S<<1,i);
for(int i=0;i<=(S<<1);++i) dfs(i);
for(int x=0;x<(S<<1);++x){
u=v=0;
for(int i=head[x];i;i=e[i].nxt){
y=e[i].to;
if(c[i>>1]) ++v;else ++u;
}
//printf("*** %d %d %d\n",x,u,v);
}
for(int i=0;i<n;++i){
for(int j=0;j<(S>>1);++j)putchar('B'+c[++w]);
puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 73360kb
input:
4
output:
CBCBCBCB CBBCCBCC BBCCBCBB CCBBBCCB
result:
wrong answer your plan fails on BBBB
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 3ms
memory: 73100kb
input:
5
output:
CBCBCCBCBBCBCCBC CBCBBCBCCBCBBCBC CBCCBCBCBCCCBBCC CBCBBCBCCBCBCCBB CCBBBCCBCCBCBCBC
result:
wrong answer your plan fails on BBBBB
Subtask #3:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 6ms
memory: 72396kb
input:
6
output:
CBCBCBCBCBCBCBCBBCBCCBCBCCBCBBCB CCBCBCBCBBCCBCBCBBCBBCCBCBCBCBBC CBCBCCBBCBCBCCBCCBBCBCCCBCCBCBBC BCCCBCBCBCCCBBCCBCBCBBCCBCBCBBCB BCCBCBBBCBBCBCCBBCBCBBCBBCBBCCBB BCBCBCCCBBBCBCCCBBCCBCBBCCBBBCCB
result:
wrong answer your plan fails on CCBBBB
Subtask #4:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 4ms
memory: 72484kb
input:
7
output:
CBCBCBCCBCBCBBCBCBCCBCBCCBCBCBBCBCBCCBCBCBCBBCBCBCCBCBCCBCBCBCBC BCBCCCBCBBCBCCBCCBCBCBBCBCBCCBCBCBCBBCCCBBCBCCBCBBCBBCBCCBCCBCBC BCBCBCCBBCBCCBCBBCBCBCCBCBCCBCBCBCBCCCBBCCBCBBCBCCBCBCCBCBCBCCBB CBCCBCBCCBCCBCBCBCBCCBCCBCBBCBCCBCCBCBCCCBCBBCBCBCCCBCBCBCCCBBCC CBCBCBBCBCBCCBCBCBCBCCBCBBCBCCBCBBCBCCCB...
result:
wrong answer your plan fails on CCCBBBB
Subtask #5:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 73352kb
input:
8
output:
CBCBCBCBCBCBCBCBCBCBCBBCBCBCCBCBCBCCBCBCBBCBCBCCBCBCBCBCBCBBCCBCBCBCBCBBCBCBBCCBBCCBCBCBCBCBBCBCCBCBCBCCBBCBCBCBCBCCBCBCCBBCBCBC BCCCBCBCCBCBCBBCBCBCCBCCBCBCBCBCBCCBCCBCBBCBCCBCBCBCBCBBCCBCBCBCBCBBCBCBBCCBCBCBCBBBCBCBBCCBBCCBBCBCBCBCBBCBCBCBBCBCBBCCBCBCBBCB BCBCCBBCCBCCBBCBBCCBBCCBCCBCBBCBCCBCBCBCBB...
result:
wrong answer your plan fails on CCBBBBBB
Subtask #6:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 71896kb
input:
9
output:
CBCBCBCBCCBCBCBCBBCBCBCBCCBCBCBCCBCBCBCBBCBCBCBCCBCBCBCBCBCBBCBCBCBCCBCBCBCCBCBCBCBCBCBCBCCBCBCCBCBCBBCBCBCCBCBCCBCBCBCBBCBCBCBCCBCBCBCBCBCBBCBCCCBBCBCBCCBCBCBBCBCBBCBCBCCBCCBCBCBCBCBCBCBCBCCBCBBCBCBCCBCBCBCBBCBCBCBCCBCBCBCCBCBCBCBCBCBCBCCBBCCCBCBCBBCBCBCC BCBCBCCBCCBBCBCBCCBBCBCBCBCCBCBCBCCBCBCCBCB...
result:
wrong answer your plan fails on CCCBBBBBB
Subtask #7:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 72236kb
input:
10
output:
CBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCCBCBCBCBCCBCBCBCBBCBCBCBCCBCBCBCBCBCBCBCBBCCBCBCBCBCBCBCBBCBCBCBBCCBBCBCCBCBCBCBCBCBCBBCBCBCCBCBCBCBCCBBCBCBCBCBCBCBCCBCBCBCCBBCBCCBBCBCBCCCBCBCBCCBCBCBCBBCBCBCBCCBCBCCBCBCBCBCBCBCBCCBCBCCBCBCBBCBCBCCBCBCBCBCBCBCBBCCBCBCBCBCBCBCBBCBCBCBBCCBCBBCCBCBCBBBCBCBCBBCCBCB...
result:
wrong answer your plan fails on BBBBBBBBBB
Subtask #8:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 73404kb
input:
11
output:
CBCBCBCBCBCCBCBCBCBCBBCBCBCBCBCCBCBCBCBCCBCBCBCBCBBCBCBCBCBCCBCBCBCBCBCBCBCBBCBCBCBCBCCBCBCBCBCCBCBCBCBCBCBCBCBCBCCBBCCBCCBCBCBCBBCBCBCBCCBCBCBCCBCBCBCBCBBCBCBCBCBCCBCBCBCBCBCBCBCBBCBCCCBCBBCBCBCBCCBCBCBCBBCBCBCBBCBCBCCBCBCCBCBCBCBCBCBCBCBCBCBCBCCBCBCBBCBCBCBCCBCBCBCBCBCBBCBCBCBCBCCBCBCBCBCCBCBCBCBC...
result:
wrong answer your plan fails on BBBBBBBBBBB
Subtask #9:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 72760kb
input:
12
output:
CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCCBCBCBCBCBCCBCBCBCBCBBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBBCCBCBCBCBCBCBCBCBCBBCBCBCBCBBCCBBCBCBCCBCBCBCBCBCBCBCBCBBCBCBCBCCBCBCBCBCBCCBBCBCBCBCBCBCBCBCBCCBCBCBCBCCBBCBCCBCBBCBCBCBCCCBCBCBCBCCBCBCBCBCBBCBCBCBCBCCBCBCBCCBCBCBCBCBCBCBCBCBCCBCBCBCCBCBCBCBBCBCBCBCCBC...
result:
wrong answer your plan fails on BBBBBBBBBBBB
Subtask #10:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 8ms
memory: 74024kb
input:
13
output:
CBCBCBCBCBCBCCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCCBBCCBCBCCBCBCBCBCBBCBCBCBCBCCBCBCBCBCCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBBCBCBCCCBCBBCBCBCBCBCCBCBCBCBCBBCBCBCBCBBCBCBCBCCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on BBBBBBBBBBBBB
Subtask #11:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 8ms
memory: 78628kb
input:
14
output:
CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCBCCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBBCCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBBCCBBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCCBCBCBCBCBCBCCBBCBCBCBCBCBCBCBCBCBCBCCBCBCBCBCBCCBBCBCCBCBCBBCBCBCBCBCCCBCBCBCBCBCCBCBCBCBCBCBBCBCBCBCBCBCCB...
result:
wrong answer your plan fails on BBBBBBBBBBBBBB
Subtask #12:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 20ms
memory: 78632kb
input:
15
output:
CBCBCBCBCBCBCBCCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBCCBBCCBCBCBCCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCCCBCBCBBCBCBCBCBCBCCBCBCBCBCBCBBCB...
result:
wrong answer your plan fails on BBBBBBBBBBBBBBB
Subtask #13:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 25ms
memory: 97840kb
input:
16
output:
CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCBCCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCBBCCBBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCCBCBCBCBCBCBCBCCBBCBCBCBCBCBCBCBCBCBCBCBCBCCBCBCBCBCBCBCCBBCBCCBCBCBCBBCBCBC...
result:
wrong answer your plan fails on BBBBBBBBBBBBBBBB
Subtask #14:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 66ms
memory: 105440kb
input:
17
output:
CBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCCBBCCBCBCBCBCCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBCB...
result:
wrong answer your plan fails on CCBBBBBBBBBBBBBBB
Subtask #15:
score: 0
Wrong Answer
Test #15:
score: 0
Wrong Answer
time: 171ms
memory: 182436kb
input:
18
output:
CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCBBCCBBCBCBCBCBCBCCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBBCBCBCBCBCBCBCCBCBCBCBCBCBCBCBCCBBCBCBCBCBCBCBCBCBCBCBCBCB...
result:
wrong answer your plan fails on CBBBBBBBBBBBBBBBBB