QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#528164#4327. Šeširihmya0 349ms112580kbC++141.8kb2024-08-23 10:55:492024-08-23 10:55:50

Judging History

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

  • [2024-08-23 10:55:50]
  • 评测
  • 测评结果:0
  • 用时:349ms
  • 内存:112580kb
  • [2024-08-23 10:55:49]
  • 提交

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;
    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^1]=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: 2ms
memory: 22240kb

input:

4

output:

CBCBBBCB
CCBCCCBB
CBCCCBCB
CCBBBBCC

result:

wrong answer your plan fails on BBBB

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

5

output:

CBCBBBCBCBCCCBCB
CCBCCCBCBCBBBCBB
CBCCBBCBCBCCBBCB
CCBCCCCCBBCBCCBB
CBCBBBBBCBCCBBCC

result:

wrong answer your plan fails on BBBBB

Subtask #3:

score: 0
Wrong Answer

Test #3:

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

input:

6

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCB
CCBCCCBCBCBBBCBBCBCCBCBCCCBBBCBB
CBCCBBCBCBCCCBCBCCBBCBCBBBCCBBCB
CCBCCCCCBBCBBCBCCBCCBCCCCBCBCCBB
CBCCBCCBCCCCBBCCBCBCCBBBBBCCBBCB
CCBBBBBCBBBBCBBBCCBBCBBBBBBCBCCC

result:

wrong answer your plan fails on BBBBBB

Subtask #4:

score: 0
Wrong Answer

Test #4:

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

input:

7

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCCBBCCBBCCBBCBCBCCBBCB
CCBCCCBCBCBBBCBCCBCCBCBCCCBBBCBCBBCBBCBCCCBBCCBBCCBBCCBCBCBBCCBB
CBCCBBCBCBCCBBCBBCBBBBCBCBCCCBCBCCBCBBCBCBCCBBCCCBCCCBCBBBCCCBCB
CCBCCCCCBBCBCCBCCBCCCBCCBBCBBCBCBBCBCCBCBCBBCCBBBCBBBCBCCCBBBCBB
CBCCBCCBCCCCBBCCBCBBBBBBCBBCCBCBCCBCBCCB...

result:

wrong answer your plan fails on BBBBBBB

Subtask #5:

score: 0
Wrong Answer

Test #5:

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

input:

8

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCBBCBCCBCCBCBBCBCCBCCBBCCBBCBCCBCBBCBBBCBBBCCCBCBCCBBBCBCCBCBBCBCBBCBCCBBCCBBBCBCCBCCBCBCBBCBCBCCBBCB
CCBCCCBCBCBBBCBBCBCCBCBCCCBBCCBCBBCBBCBCCBCBBCBBCCBBCCBCBBCBCCBBCCBCCCBBBCBCBBCCCBCBBCBCCBCBCCBCBBCCBBCCCBCBBCBBCBCBCCBCBCBBCCBB
CBCCBBCBCBCCBBCBBCBBBBCBCBCCCBCBCCBCBBCBCC...

result:

wrong answer your plan fails on BBBBBBBB

Subtask #6:

score: 0
Wrong Answer

Test #6:

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

input:

9

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCCBBCCBBCCBBCBCBCCCBCBBBCBBBCCCBCBBCBBBBCCBBCBCBCCCBCBCBCBCCBBBBCCBBCCCBCCCBCBBBCCCBCBCBCCBBCCCBCBCCBCBBCCBBCBCBCCCBCBCBCBBCBBCBCCBBCCBBCBCBCBBBCCBBCCCBCBBCBBCBCCBBCCBCBBCBCBBBCCBBCBCBCCBBCBCBCCCBCCCBCBBBCBCBCCCBCB
CCBCCCBCBCBBBCBBCBCCBCBCCCBBBCBCBBCBBCBCCCB...

result:

wrong answer your plan fails on BBBBBBBBB

Subtask #7:

score: 0
Wrong Answer

Test #7:

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

input:

10

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCBBCBCCBCCBCBBCBCCBCCBBCCBBCBCBCCCBCBBBCBBBCCCBCBBCBBBCBCCBCBBBCCCBCBCCBBCCBBBBCCBBCCCBCBBCBBCBCCBBCBCBCCBBCCCCBBCCBCBBCCBBCBCBCCCBCBCCBBCCBCBBCBBCBCBBCCCBCBBBCCCBCCCCBBCCBBBBCCBBCCCBCBBCBBCBCCCBCBBBCCCBCCBBCBBCBCCBCBCCBBBBCCCBCBBCBBCBCBBBCCCBCBCCBBCCBBBBCCBBCCBCBCCBCBBBCC...

result:

wrong answer your plan fails on BBBBBBBBBB

Subtask #8:

score: 0
Wrong Answer

Test #8:

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

input:

11

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCCBBCCBBCCBBCBCCBCBBCBBBCBBBCCCBCBCCBBBBCCBBCBCCBCBBCBCBCBCCBBBCBCCBCCCCBCBBCBCBCCCBCBCBCCBBCCCBCBBCBCBBCCBBCBCCBCBBCBCBCBBCBBCCBCCBCCBCBBBBCBCBCCBBCCCBCBBCBBCCBCCBCCBCBBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCCBCCBCBBCBBCBCBBBCCBBCBCBCBBCBBCCBCCBCCBBCCBBCBCCBC...

result:

wrong answer your plan fails on BBBBBBBBBBB

Subtask #9:

score: 0
Wrong Answer

Test #9:

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

input:

12

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCBBCBCCBCCBCBBCBCCBCCBBCCBBCBCCBCCBCBBBCBBBCCCBCBBCBBBCBCCBCBBCBCCBCBCCBBCCBBBBCCBBCCCCBBCCBBBCBCCBCBCBCCBBCCCCBBCCBCBBCCBBCBCCBCBBCBCCBBCCBCBCBBCCBCBCBCBBCBCCBCBBCCCCBBCCBBBCBCBBCCCCBBCCBBBCBCCBCBBCBCBBCBCCBCBBCCBCBCCBCBBCBCBBCBBCBBCBCBBBCCBBCBCCBBCCBBBCBCCBCCBCBCCBCBBCBC...

result:

wrong answer your plan fails on BBBBBBBBBBBB

Subtask #10:

score: 0
Wrong Answer

Test #10:

score: 0
Wrong Answer
time: 9ms
memory: 30448kb

input:

13

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCCBBCCBBCCBBCBCBCCCBCBBBCBBBCCCBCBCCBBBBCCBBCBCBCCCBCBCBCBCCBBBBCCBBCCCBCCCBCBBBCCBBCBCBCCBBCCCBCBBCBCBBCCBBCBCBCCCBCBCBCBBCBBCBCCBBCCBBCBCCBBBBCCCBCCCBCBBCBBCBCCBBCCBBCBCBCBBBCCBBCBCBCCBBCCCBCBCCBCCBCBBCBBCCBCBBCBBCBBCBCBBBCCCBCBCBCBBCBBCBCCBBCCBBCCCBCBBBCC...

result:

wrong answer your plan fails on BBBBBBBBBBBBB

Subtask #11:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 16ms
memory: 32552kb

input:

14

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCBBCBCCBCCBCBBCBCCBCCBBCCBBCBCBCCBBCBBBCBBBCCCBCBBCBBBCBCCBCBBBCCBBCBCCBBCCBBBCBCCBCCCBCBBCBBCBCCBBCBCBCCBBCCCCBBCCBCBBCCBBCBCCBCCBCBCCBBCCBCBBCBBCBCBCBCCBCBBBCCCBCCCCBBCCBBBCBCCBCCCCBBCCBBBBCCBBCBBBCCBBCCCBCBCCBCBBCCBBCBCCBCBBCBBCBBCBCBBBCCBBCBCCBBCCBBBCBCCBCCBCBCCBCBBBCC...

result:

wrong answer your plan fails on BBBBBBBBBBBBBB

Subtask #12:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 20ms
memory: 39272kb

input:

15

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCCBBCCBBCCBBCBCCBCBBCBBBCBBBCCCBCBCCBBBBCCBBCBCCBCBBCBCBCBCCBBBCBCCBCCCCBCBBCBCBCCBBCBCBCCBBCCCBCBBCBCBBCCBBCBCCBCBBCBCBCBBCBBCCBCCBCCBCBBBCBBCBCCCBCCCBCBBCBBCCBCCBCCBCBBBBCBCBCCBBCBCBCCBBCBCBCCCBCCCBCCBBCBCBCCCBCBBCBBCBCBBBCCCBCBCBCBBCBBCCBCCBCCBBCCCBCBBCBC...

result:

wrong answer your plan fails on BBBBBBBBBBBBBBB

Subtask #13:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 58ms
memory: 48548kb

input:

16

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCBBCBCCBCCBCBBCBCCBCCBBCCBBCBCBCCBBCBBBCBBBCCCBCBBCBBBCBCCBCBBBCCBBCBCCBBCCBBBCBCCBCCCBCBBCBBCCBCCBCBCBCCBBCCCCBBCCBCBBCCBBCBCCBCCBCBCCBBCCBCBBCBBCBCBCBCCBCBBCBCBBCCCCBBCCBBBCBCCBCCCBCBBCBBCCBCCBCBBCBCCBCBBCBCBBCCCCBBCCBBBBCCBBCBBCBBCBCBBBCCBBCBCCBBCCBBBCBCCBCCBCBCCBCBBBCC...

result:

wrong answer your plan fails on BBBBBBBBBBBBBBBB

Subtask #14:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 145ms
memory: 71780kb

input:

17

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCCBCBCCBCCBCBBBCCBBCCBBCCBBCBCBCCCBCBBBCBBBCCCBCBCCBBBBCCBBCBCBCCCBCBCBCBCCBBBBCCBBCCCBCCCBCBBBCCBBCBCBCCBBCCCBCBBCBCBBCCBBCBCBCCCBCBCBCBBCBBCBCCBBCCBBCBCCBBBBCCCBCCCBCBBCBBCBCCBBCCBBCBCBCBBBCCCBCBCBCCBBCCCBCBBCBCCBCBCCBBBBCCCBCBBCBBCBCBBBCCCBCBCBCBBCBBCBCCBBCCBBCCCBCBBBCC...

result:

wrong answer your plan fails on BBBBBBBBBBBBBBBBB

Subtask #15:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 349ms
memory: 112580kb

input:

18

output:

CBCBBBCBCBCCCBCBBCBBCBCBBBCCBBCBCCBCCBCBBCBCCBCCBBCCBBCBCCBCCBCBBBCBBBCCCBCBBCBBBCBCCBCBBCBCCBCBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCBCBCCBBCCCCBBCCBCBBCCBBCBCBCCBBCBCCBBCCBCBCBBCCBCBBCCBBCBCBCCCBCCCCBBCCBBBBCCBBCCCBCBBCBBCBCCBBCBBCBCCBCBBBCCCBCCCBCBBCBBCBCCCBCBBCBBCBCBBBCCBBCBCCBBCCBBBBCCBBCCBCBCCBCBBCBC...

result:

wrong answer your plan fails on BBBBBBBBBBBBBBBBBB