QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#528162#4327. Šeširihmya0 384ms114292kbC++141.9kb2024-08-23 10:50:442024-08-23 10:50:44

Judging History

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

  • [2024-08-23 10:50:44]
  • 评测
  • 测评结果:0
  • 用时:384ms
  • 内存:114292kb
  • [2024-08-23 10:50:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
bool tag[600005*20];//给边定向
bool vis[600005];
struct node{
    int v,id;
};
vector<node> ljb[600005];
int head[600005];
int tot=1;
void solve(int cur){
    vis[cur]=true;
    // 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});
    //         // printf("%d %d\n",i,1<<n+1);
    //     // }
    // }
    // solve(1<<n+1);
    for(int i=0;i<(1<<n+1);i++){
        if(!vis[i])solve(i);
    }
    // return 0;
    int pos=1;
    for(int i=0;i<n;i++){
        // return 0;
        for(int S=0;S<(1<<n);S++){
            if((S>>i)&1)continue;
            if(tag[++pos]){//选左边,也就是B
                ans[i][S]=false;
            }
            if(tag[++pos]){//选右边,也就是C
                ans[i][S]=true;
            }
        }
    }
    // return 0;
    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: 0ms
memory: 24256kb

input:

4

output:

BCBCCCBC
BBCBBBCC
BCBBBCBC
BBCCCCBB

result:

wrong answer your plan fails on CCCB

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

5

output:

BCBCCCBCBCBBBCBC
BBCBBBCBCBCCCBCC
BCBBCCBCBCBBCCBC
BBCBBBBBCCBCBBCC
BCBCCCCCBCBBCCBB

result:

wrong answer your plan fails on CCCCB

Subtask #3:

score: 0
Wrong Answer

Test #3:

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

input:

6

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBC
BBCBBBCBCBCCCBCCBCBBCBCBBBCCCBCC
BCBBCCBCBCBBBCBCBBCCBCBCCCBBCCBC
BBCBBBBBCCBCCBCBBCBBCBBBBCBCBBCC
BCBBCBBCBBBBCCBBCBCBBCCCCCBBCCBC
BBCCCCCBCCCCBCCCBBCCBCCCCCCBCBBB

result:

wrong answer your plan fails on CCBBBB

Subtask #4:

score: 0
Wrong Answer

Test #4:

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

input:

7

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBCBBCBBCBCCCBBCCBBCCBBCCBCBCBBCCBC
BBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCCBBCCBBCCBBCBCBCCBBCC
BCBBCCBCBCBBCCBCCBCCCCBCBCBBBCBCBBCBCCBCBCBBCCBBBCBBBCBCCCBBBCBC
BBCBBBBBCCBCBBCBBCBBBCBBCCBCCBCBCCBCBBCBCBCCBBCCCBCCCBCBBBCCCBCC
BCBBCBBCBBBBCCBBCBCCCCCCBCCBBCBCBBCBCBBC...

result:

wrong answer your plan fails on CCCCBBB

Subtask #5:

score: 0
Wrong Answer

Test #5:

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

input:

8

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBCCBCBBCBBCBCCBCBBCBBCCBBCCBCBBCBCCBCCCBCCCBBBCBCBBCCCBCBBCBCCBCBCCBCBBCCBBCCCBCBBCBBCBCBCCBCBCBBCCBC
BBCBBBCBCBCCCBCCBCBBCBCBBBCCBBCBCCBCCBCBBCBCCBCCBBCCBBCBCCBCBBCCBBCBBBCCCBCBCCBBBCBCCBCBBCBCBBCBCCBBCCBBBCBCCBCCBCBCBBCBCBCCBBCC
BCBBCCBCBCBBCCBCCBCCCCBCBCBBBCBCBBCBCCBCBB...

result:

wrong answer your plan fails on CCBBBBBB

Subtask #6:

score: 0
Wrong Answer

Test #6:

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

input:

9

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBCBBCBBCBCCCBBCCBBCCBBCCBCBCBBBCBCCCBCCCBBBCBCCBCCCCBBCCBCBCBBBCBCBCBCBBCCCCBBCCBBBCBBBCBCCCBBBCBCBCBBCCBBBCBCBBCBCCBBCCBCBCBBBCBCBCBCCBCCBCBBCCBBCCBCBCBCCCBBCCBBBCBCCBCCBCBBCCBBCBCCBCBCCCBBCCBCBCBBCCBCBCBBBCBBBCBCCCBCBCBBBCBC
BBCBBBCBCBCCCBCCBCBBCBCBBBCCCBCBCCBCCBCBBBC...

result:

wrong answer your plan fails on CCCCBBBBB

Subtask #7:

score: 0
Wrong Answer

Test #7:

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

input:

10

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBCCBCBBCBBCBCCBCBBCBBCCBBCCBCBCBBBCBCCCBCCCBBBCBCCBCCCBCBBCBCCCBBBCBCBBCCBBCCCCBBCCBBBCBCCBCCBCBBCCBCBCBBCCBBBBCCBBCBCCBBCCBCBCBBBCBCBBCCBBCBCCBCCBCBCCBBBCBCCCBBBCBBBBCCBBCCCCBBCCBBBCBCCBCCBCBBBCBCCCBBBCBBCCBCCBCBBCBCBBCCCCBBBCBCCBCCBCBCCCBBBCBCBBCCBBCCCCBBCCBBCBCBBCBCCCBB...

result:

wrong answer your plan fails on CCBBBBBBBB

Subtask #8:

score: 0
Wrong Answer

Test #8:

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

input:

11

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBCBBCBBCBCCCBBCCBBCCBBCCBCBBCBCCBCCCBCCCBBBCBCBBCCCCBBCCBCBBCBCCBCBCBCBBCCCBCBBCBBBBCBCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBBCCBCBBCBCCBCBCBCCBCCBBCBBCBBCBCCCCBCBCBBCCBBBCBCCBCCBBCBBCBBCBCCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBBCBBCBCCBCCBCBCCCBBCCBCBCBCCBCCBBCBBCBBCCBBCCBCBBCB...

result:

wrong answer your plan fails on CCCCBBBBBBB

Subtask #9:

score: 0
Wrong Answer

Test #9:

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

input:

12

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBCCBCBBCBBCBCCBCBBCBBCCBBCCBCBBCBBCBCCCBCCCBBBCBCCBCCCBCBBCBCCBCBBCBCBBCCBBCCCCBBCCBBBBCCBBCCCBCBBCBCBCBBCCBBBBCCBBCBCCBBCCBCBBCBCCBCBBCCBBCBCBCCBBCBCBCBCCBCBBCBCCBBBBCCBBCCCBCBCCBBBBCCBBCCCBCBBCBCCBCBCCBCBBCBCCBBCBCBBCBCCBCBCCBCCBCCBCBCCCBBCCBCBBCCBBCCCBCBBCBBCBCBBCBCCBCB...

result:

wrong answer your plan fails on CCBBBBBBBBBB

Subtask #10:

score: 0
Wrong Answer

Test #10:

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

input:

13

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBCBBCBBCBCCCBBCCBBCCBBCCBCBCBBBCBCCCBCCCBBBCBCBBCCCCBBCCBCBCBBBCBCBCBCBBCCCCBBCCBBBCBBBCBCCCBBCCBCBCBBCCBBBCBCCBCBCCBBCCBCBCBBBCBCBCBCCBCCBCBBCCBBCCBCBBCCCCBBBCBBBCBCCBCCBCBBCCBBCCBCBCBCCCBBCCBCBCBBCCBBBCBCBBCBBCBCCBCCBBCBCCBCCBCCBCBCCCBBBCBCBCBCCBCCBCBBCCBBCCBBBCBCCCBB...

result:

wrong answer your plan fails on CCCCBBBBBBBBB

Subtask #11:

score: 0
Wrong Answer

Test #11:

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

input:

14

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBCCBCBBCBBCBCCBCBBCBBCCBBCCBCBCBBCCBCCCBCCCBBBCBCCBCCCBCBBCBCCCBBCCBCBBCCBBCCCBCBBCBBBCBCCBCCBCBBCCBCBCBBCCBBBBCCBBCBCCBBCCBCBBCBBCBCBBCCBBCBCCBCCBCBCBCBBCBCCCBBBCBBBBCCBBCCCBCBBCBBBBCCBBCCCCBBCCBCCCBBCCBBBCBCBBCBCCBBCCBCBBCBCCBCCBCCBCBCCCBBCCBCBBCCBBCCCBCBBCBBCBCBBCBCCCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBB

Subtask #12:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 23ms
memory: 39148kb

input:

15

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBCBBCBBCBCCCBBCCBBCCBBCCBCBBCBCCBCCCBCCCBBBCBCBBCCCCBBCCBCBBCBCCBCBCBCBBCCCBCBBCBBBBCBCCBCBCBBCCBCBCBBCCBBBCBCCBCBCCBBCCBCBBCBCCBCBCBCCBCCBBCBBCBBCBCCCBCCBCBBBCBBBCBCCBCCBBCBBCBBCBCCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBCCBCCBCBCCCBBBCBCBCBCCBCCBBCBBCBBCCBBBCBCCBCB...

result:

wrong answer your plan fails on CCCCBBBBBBBBBBB

Subtask #13:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 43ms
memory: 48436kb

input:

16

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBCCBCBBCBBCBCCBCBBCBBCCBBCCBCBCBBCCBCCCBCCCBBBCBCCBCCCBCBBCBCCCBBCCBCBBCCBBCCCBCBBCBBBCBCCBCCBBCBBCBCBCBBCCBBBBCCBBCBCCBBCCBCBBCBBCBCBBCCBBCBCCBCCBCBCBCBBCBCCBCBCCBBBBCCBBCCCBCBBCBBBCBCCBCCBBCBBCBCCBCBBCBCCBCBCCBBBBCCBBCCCCBBCCBCCBCCBCBCCCBBCCBCBBCCBBCCCBCBBCBBCBCBBCBCCCBB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBB

Subtask #14:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 153ms
memory: 71856kb

input:

17

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBCBBCBBCBCCCBBCCBBCCBBCCBCBCBBBCBCCCBCCCBBBCBCBBCCCCBBCCBCBCBBBCBCBCBCBBCCCCBBCCBBBCBBBCBCCCBBCCBCBCBBCCBBBCBCCBCBCCBBCCBCBCBBBCBCBCBCCBCCBCBBCCBBCCBCBBCCCCBBBCBBBCBCCBCCBCBBCCBBCCBCBCBCCCBBBCBCBCBBCCBBBCBCCBCBBCBCBBCCCCBBBCBCCBCCBCBCCCBBBCBCBCBCCBCCBCBBCCBBCCBBBCBCCCBB...

result:

wrong answer your plan fails on CCCCBBBBBBBBBBBBB

Subtask #15:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 384ms
memory: 114292kb

input:

18

output:

BCBCCCBCBCBBBCBCCBCCBCBCCCBBCCBCBBCBBCBCCBCBBCBBCCBBCCBCBBCBBCBCCCBCCCBBBCBCCBCCCBCBBCBCCBCBBCBCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBCBCBBCCBBBBCCBBCBCCBBCCBCBCBBCCBCBBCCBBCBCBCCBBCBCCBBCCBCBCBBBCBBBBCCBBCCCCBBCCBBBCBCCBCCBCBBCCBCCBCBBCBCCCBBBCBBBCBCCBCCBCBBBCBCCBCCBCBCCCBBCCBCBBCCBBCCCCBBCCBBCBCBBCBCCBCB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBBBBB