QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#528139#4327. Šeširihmya0 350ms230448kbC++141.6kb2024-08-23 10:16:102024-08-23 10:16:10

Judging History

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

  • [2024-08-23 10:16:10]
  • 评测
  • 测评结果:0
  • 用时:350ms
  • 内存:230448kb
  • [2024-08-23 10:16:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
bool tag[300005*20];//给边定向
struct node{
    int v,id;
};
vector<node> ljb[600005];
int head[600005];
int tot=1;
void solve(int cur){
    // printf("solve %d\n",cur);
    for(int i=head[cur];i<ljb[cur].size();i=head[cur]){
        head[cur]=i+1;
        int v=ljb[cur][i].v;
        int id=ljb[cur][i].id;
        if(tag[id]||tag[id^1])continue;
        tag[id]=true;
        solve(v);
    }
    return;
}
bool ans[20][600005];
int d[600005];
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        for(int S=0;S<(1<<n);S++){//枚举S表示状态,0放左边1放右边
            if((S>>i)&1)continue;
            // printf("%d %d\n",S,(S|(1<<i))+(1<<n));
            ljb[S].push_back(node{(S|(1<<i))+(1<<n),++tot});
            ljb[(S|(1<<i))+(1<<n)].push_back(node{S,++tot});
            d[S]++;
            d[(S|(1<<i))+(1<<n)]++;
        }
    }
    for(int i=0;i<(1<<n+1);i++){
        if(d[i]&1){
            ljb[1<<n+1].push_back(node{i,++tot});
            ljb[i].push_back(node{1<<n+1,++tot});
        }
    }
    solve(1<<n+1);
    int pos=1;
    for(int i=0;i<n;i++){
        for(int S=0;S<(1<<n);S++){
            if((S>>i)&1)continue;
            if(tag[++pos]){//选左边,也就是B
                ans[i][S]=false;
            }
            if(tag[++pos]){
                ans[i][S]=true;
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int S=0;S<(1<<n);S++){
            if((S>>i)&1)continue;
            putchar(ans[i][S]?'C':'B');
        }
        puts("");
    }
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 24192kb

input:

4

output:

CCBCCCBC
BBCCBBCC
CCBBCCBB
BBCCBBBB

result:

wrong answer your plan fails on CCCC

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 4ms
memory: 24140kb

input:

5

output:

BBBCBCBBBCBBCBBC
CBBBBBCBBBCBBBBC
BBBBBCBBBCBBCBBB
CBBCBCBBBBCBBBBB
BBBBBBBBBBBBBBBB

result:

wrong answer your plan fails on CCBBB

Subtask #3:

score: 0
Wrong Answer

Test #3:

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

input:

6

output:

CCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBC
BBCCBBCBCBCCBBCCBBCCBBCBCBCCBBCC
CCBBCCBCBCBBCCBCCCBBCCBCBCBBCCBC
BBCCBBBBCCCCCBCBBBCCBBBBCCCCCBCB
CCBCCCCCBBCBBCBBCCBCCCCCBBCBBCBB
BBCBBBBBCCBBCCCCBBBBBBBCBBBBBBBB

result:

wrong answer your plan fails on CCCCBB

Subtask #4:

score: 0
Wrong Answer

Test #4:

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

input:

7

output:

BBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBCBCBBBCBBCBBC
CBBBBBCBBBCBBBBCBBCBBBBBCBBCBBCBBBCBBBBCCBBBBCBBBBBCBBCBBBCBBBBC
BBBBBCBBBCBBCBBBBCBBCBBCBBBBBCBBBCBBCBBCBBBBBBCBCBBBBCBBBCBBCBBC
CBBCBCBBBBCBBBBBBBCBBBBBCBBCBBCBBBCBBBBBCBBCBCBBBBBCBBBBBCCBCBBB
BBBBBBBBBBBBBBBBBCBBCBBCBBBBBCBBBCBBCBBC...

result:

wrong answer your plan fails on CCBBBBB

Subtask #5:

score: 0
Wrong Answer

Test #5:

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

input:

8

output:

CCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBC
BBCCBBCBCBCCBBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCBBCCBBCBCBCCBBCCBBCCBBCBCBCCBBCCBBCBBCBBCBCCBBCBCBCCBBCBCBCCCBCCBBCCBBCBCBCCBBCC
CCBBCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBC...

result:

wrong answer your plan fails on CCCCBBBB

Subtask #6:

score: 0
Wrong Answer

Test #6:

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

input:

9

output:

BBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBBBBBBBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBBBCBBBCBBCBBBBBBCBBCBBCBBBBBCBCBBBBBBCBBCBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBCBBBBBCBBCBBCBCBBBCBBCBBC
CBBBBBCBBBCBBBBCBBCBBBBBCBBCBBCBBBCBBBBCCBB...

result:

wrong answer your plan fails on CCBBBBBBB

Subtask #7:

score: 0
Wrong Answer

Test #7:

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

input:

10

output:

CCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...

result:

wrong answer your plan fails on CCCCBBBBBB

Subtask #8:

score: 0
Wrong Answer

Test #8:

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

input:

11

output:

BBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBBBBBBBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBBBCBBBCBBCBBBBBBCBBCBBCBBBBBCBCBBBBBBCBBCBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBCBBBBBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBB

Subtask #9:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 4ms
memory: 32568kb

input:

12

output:

CCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...

result:

wrong answer your plan fails on CCCCBBBBBBBB

Subtask #10:

score: 0
Wrong Answer

Test #10:

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

input:

13

output:

BBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBBBBBBBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBBBCBBBCBBCBBBBBBCBBCBBCBBBBBCBCBBBBBBCBBCBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBCBBBBBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBB

Subtask #11:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 8ms
memory: 40100kb

input:

14

output:

CCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...

result:

wrong answer your plan fails on CCCCBBBBBBBBBB

Subtask #12:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 27ms
memory: 45312kb

input:

15

output:

BBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBBBBBBBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBBBCBBBCBBCBBBBBBCBBCBBCBBBBBCBCBBBBBBCBBCBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBCBBBBBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBB

Subtask #13:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 57ms
memory: 73404kb

input:

16

output:

CCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...

result:

wrong answer your plan fails on CCCCBBBBBBBBBBBB

Subtask #14:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 100ms
memory: 100248kb

input:

17

output:

BBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBBBBBBBCBBCBBCBBBBBCBBBCBBCBBBBBBCBBCBCBBBBCBBBCBBCBBBBBBCBBCBBCBBBBBCBCBBBBBBCBBCBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBBCBBCBBCBBBBBCBBCBBCBCBBBCBBCBBCBCBBCBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBBB

Subtask #15:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 350ms
memory: 230448kb

input:

18

output:

CCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...

result:

wrong answer your plan fails on CCCCBBBBBBBBBBBBBB