QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#569968#4327. ŠeširiWilliamxzh0 167ms122580kbC++231.1kb2024-09-17 12:56:382024-09-17 12:56:39

Judging History

你现在查看的是最新测评结果

  • [2024-09-17 12:56:39]
  • 评测
  • 测评结果:0
  • 用时:167ms
  • 内存:122580kb
  • [2024-09-17 12:56:38]
  • 提交

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<n;++i){
        for(int j=0;j<(S>>1);++j){
            x=(j&((1<<i)-1)),y=(j^x),z=(y<<1)+x;
            u=z,v=(z|(1<<i))+S,adde(u,v),++in[u],++in[v];
        }
    }
    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 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: 71532kb

input:

4

output:

CBCBBBCB
BCBBCCBB
CBCCBBCC
BCBBCCCC

result:

wrong answer your plan fails on CCBB

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 3ms
memory: 72836kb

input:

5

output:

CBCBBBCBCBCCBBCB
BCBBCCBCBCBBCCBB
CBCCBBCBCBCCBBCC
BCBBCCCCBCBBCCBC
CBCCBCCBCCCCCBCC

result:

wrong answer your plan fails on CCCCB

Subtask #3:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 3ms
memory: 72484kb

input:

6

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBBBCB
BCBBCCBCBCBBCCBBCCBBCCBBBCBCCCBB
CBCCBBCCCBCBBBCBBBCCBBCCCBCBBBCB
BCBBCCCBBBBCBCBCCCBBCCCBBBBCBBCC
CBCBBBBCCCBBCBCCBBCBBBBCCCBBCCBC
BCBCCCCCBBCCBBBBCCCCCCCBCCCCCCCC

result:

wrong answer your plan fails on CCBBBB

Subtask #4:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 7ms
memory: 72020kb

input:

7

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCB
BCBBCCBCBCBBCCBBCCBCCCBBBCBCBCBCBCBBCCBCBCBBCCBBCBCBBCBCCCBBCCBB
CBCCBBCBCBCCBBCBBBCBBBCCCBCBBBCBCBCCBBCCCBCBCBCCBCBCCBCBBBCCBBCB
BCBBCCCCBBBBBCBCCCBCCBCBBBCCCBCCBCBBCCBBBCBCBCBBCBCBBCCCCBBBBCBC
CBCBBBBBCCBCCBCCBBCBBBBCCBBBBCBBCBCCBCCC...

result:

wrong answer your plan fails on CCCCBBB

Subtask #5:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 7ms
memory: 72272kb

input:

8

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCCCBCCBBCBCBCCBBCBBCBBCBCBBBCCBBCB
BCBBCCBCBCBBCCBBCCBCCCBBBCBCBCBCBCBBCCBCBCBBCCBBCBCBBCBCCCBBCCBBCCBBCCBCBCBBCCBBCCBCCCBBBCBCBCBBBCBBCCBCBCBBCCBCCBCBBCBCCCBBCCBB
CBCCBBCCCBCBBBCBBBCCBBCCCBCBBBCBCBCBBBCBCB...

result:

wrong answer your plan fails on CCBBBBBB

Subtask #6:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 71708kb

input:

9

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCB
BCBBCCBCBCBBCCBBCCBCCCBBBCBCBCBCBCBBCCBCBCB...

result:

wrong answer your plan fails on CCCCBBBBB

Subtask #7:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 7ms
memory: 72292kb

input:

10

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCC...

result:

wrong answer your plan fails on CCBBBBBBBB

Subtask #8:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 3ms
memory: 71964kb

input:

11

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCCCBBBBBBB

Subtask #9:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 74208kb

input:

12

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCBBBBBBBBBB

Subtask #10:

score: 0
Wrong Answer

Test #10:

score: 0
Wrong Answer
time: 12ms
memory: 72880kb

input:

13

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCCCBBBBBBBBB

Subtask #11:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 12ms
memory: 75568kb

input:

14

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCBBBBBBBBBBBB

Subtask #12:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 14ms
memory: 76812kb

input:

15

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCCCBBBBBBBBBBB

Subtask #13:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 31ms
memory: 84892kb

input:

16

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBB

Subtask #14:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 74ms
memory: 91132kb

input:

17

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCCCBBBBBBBBBBBBB

Subtask #15:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 167ms
memory: 122580kb

input:

18

output:

CBCBBBCBCBCCBBCBBBCBBBCCCBCBCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCCCBCCBBCCCBCBBCBBCCBBCBCBBBCCCBCBCBCCBBCBCBCCBBCCBCBBCBCBBBCCCBCBCBCCBBCCCBCBBCBCBCBCCBCBBBCCBBCCBCBBCBCBBBCCBBCBCBCBBBCCCBCBBBCBBBCCBBCBCBCCCBCCBCBBCBCBBBCCBBCBBBCBBBCBCCBCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCC...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBBBB