QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#528141#4327. Šeširihmya0 439ms229468kbC++141.6kb2024-08-23 10:17:132024-08-23 10:17:14

Judging History

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

  • [2024-08-23 10:17:14]
  • 评测
  • 测评结果:0
  • 用时:439ms
  • 内存:229468kb
  • [2024-08-23 10:17:13]
  • 提交

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=(1<<n)-1;S>=0;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: 0ms
memory: 22252kb

input:

4

output:

CBCCCBCC
CCBBCCBB
BBCCBBCC
BBBBCCBB

result:

wrong answer your plan fails on CCCC

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

5

output:

CBBCBBCBBBCBCBBB
CBBBBCBBBCBBBBBC
BBBCBBCBBBCBBBBB
BBBBBCBBBBCBCBBC
BBBBBBBBBBBBBBBB

result:

wrong answer your plan fails on CCBBB

Subtask #3:

score: 0
Wrong Answer

Test #3:

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

input:

6

output:

CBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCC
CCBBCCBCBCBBCCBBCCBBCCBCBCBBCCBB
CBCCBBCBCBCCBBCCCBCCBBCBCBCCBBCC
BCBCCCCCBBBBCCBBBCBCCCCCBBBBCCBB
BBCBBCBBCCCCCBCCBBCBBCBBCCCCCBCC
BBBBBBBBCBBBBBBBCCCCBBCCBBBBBCBB

result:

wrong answer your plan fails on CCBBBB

Subtask #4:

score: 0
Wrong Answer

Test #4:

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

input:

7

output:

CBBCBBCBBBCBCBBCBCBBCBBBBBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBB
CBBBBCBBBCBBCBBBBBCBBBBCCBBBBCBBBCBBCBBCBBBBBCBBCBBBBCBBBCBBBBBC
CBBCBBCBBBCBBBBCBCBBBBBBCBBCBBCBBBCBBBBBCBBCBBCBBBBCBBCBBBCBBBBB
BBBCBCCBBBBBCBBBBBCBCBBCBBBBBCBBBCBBCBBCBBBBBCBBBBBBBCBBBBCBCBBC
BBBBBCBBBCCBCBBCBCBBBBBBCBBCBBCBBBCBBBBB...

result:

wrong answer your plan fails on CCBBBBB

Subtask #5:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 5ms
memory: 26456kb

input:

8

output:

CBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCC
CCBBCCBCBCBBCCBBCCBCCCBCBCBBCCBCBCBBCCBCBBCBBCBBCCBBCCBCBCBBCCBBCCBBCCBCBCBBCCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBBCCBCBCBBCCBB
CBCCBBCBCBCCBBCCBBCBBBCBCBCCBBCBCBCCBBCBCC...

result:

wrong answer your plan fails on CCBBBBBB

Subtask #6:

score: 0
Wrong Answer

Test #6:

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

input:

9

output:

CBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBCBBCBBBBBBCBCBBBBBCBBCBBCBBBBBBCBBCBBBCBBBBCBCBBCBBBBBBCBBCBBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBCBBCBBBBBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBB
CBBBBCBBBCBBCBBBBCBBCBBCBBBBBCBBBCBBCBBCBBB...

result:

wrong answer your plan fails on CCBBBBBBB

Subtask #7:

score: 0
Wrong Answer

Test #7:

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

input:

10

output:

CBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCBBCBBBCBCBCCBBCBCCBCCBCCBCBBCBCCCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBC...

result:

wrong answer your plan fails on CCBBBBBBBB

Subtask #8:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 6ms
memory: 26904kb

input:

11

output:

CBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBCBBCBBBBBBCBCBBBBBCBBBCBBBBCBBBCBBCBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBB

Subtask #9:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 5ms
memory: 30568kb

input:

12

output:

CBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCBBCBBBCBCBCCBBCBCCBCCBCCBCBBCBCCCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCCBC...

result:

wrong answer your plan fails on CCBBBBBBBBBB

Subtask #10:

score: 0
Wrong Answer

Test #10:

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

input:

13

output:

CBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBB

Subtask #11:

score: 0
Wrong Answer

Test #11:

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

input:

14

output:

CBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCBBCBBBCBCBCCBBCBCCBCCBCCBCBBCBCCCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCCBC...

result:

wrong answer your plan fails on CCBBBBBBBBBBBB

Subtask #12:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 25ms
memory: 43672kb

input:

15

output:

CBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBB

Subtask #13:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 50ms
memory: 77024kb

input:

16

output:

CBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCBBCBBBCBCBCCBBCBCCBCCBCCBCBBCBCCCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCCBC...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBB

Subtask #14:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 126ms
memory: 100580kb

input:

17

output:

CBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBBCBBCBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBCBBBBBCBBCBBCBCBBCBBCBBBCBCBBCBBCBBBBBCBBCBBCBBBBBBBCBBBCBBBBBCBBCBBCBBCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBBB

Subtask #15:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 439ms
memory: 229468kb

input:

18

output:

CBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCCBCCBCCBBCBBBCBCBCCBBCBCCBCCBCCBCBBCBCCCBCCBBCBCCBCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCCBBCBBBCBCBCCBBCBBBCBBBCBCBCCBBCBCBCCBBCBCCBC...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBBBB