QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#528148 | #4327. Šeširi | hmya | 0 | 376ms | 231200kb | C++14 | 1.8kb | 2024-08-23 10:32:20 | 2024-08-23 10:32:20 |
Judging History
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);
}
}
for(int i=0;i<(1<<n+1);i++){
if(!vis[i])solve(i);
}
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]){//选右边,也就是C
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;
}
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: 24352kb
input:
4
output:
BCBCCCBC CBCCBBCC BCBBCCBB CBCCBBBB
result:
wrong answer your plan fails on CCCC
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 4ms
memory: 24276kb
input:
5
output:
BCBCCCBCBCBBCCBC BBCBBBCBCBCCBBCC CCBBCCBCBCBBCCBB BBCCBCBBCBCCBBCB CCBBCBBCBBBBBCBB
result:
wrong answer your plan fails on CCCCC
Subtask #3:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 26212kb
input:
6
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBC CBCCBBCBCBCCBBCCBBCCBBCBCBCCBBCC BCBBCCBCBCBBCCBCCCBBCCBCBCBBCCBC CBCCBBBBCCCCCBCBBBCCBBBBCCCCCBCB BCBCCCCCBBCBBCBBCCBCCCCCBBCBBCBB CBCBBBBBCCBBCCCCBBBBBBBCBBBBBBBB
result:
wrong answer your plan fails on CCCCBB
Subtask #4:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 26304kb
input:
7
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBCCCBCBCBBCCBC BBCBBBCBCBCCBBCCBBCBBBCBCBCCCBCBCBCCBBCCCBCBBCBCBBCCBBCBCBCCBBCC CCBBCCBCBCBBCCBBCCBCCCBCBCBBBCBCBCBBCCBCBCBBCBCBCCBBBCBCCCBBCCBC BBCCBCBBCBCCBBCBBBCBBCBBCCBCCBCBCBCCBBCBCBCCBCBCBBCCCBBBBCCCCBCB CCBBCBBCBBBBBCBBCCBCCCCCBCCBBCBCBCBBCBBC...
result:
wrong answer your plan fails on CCCCBBB
Subtask #5:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 26380kb
input:
8
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBC CBCCBBCBCBCCBBCCBBCBBBCBCBCCBBCBCBCCBBCBCBCCCBCCBBCCBBCBCBCCBBCCBBCCBBCBCBCCBBCCBBCBBCBBCBCCBBCBCBCCBBCBCBCCCBCCBBCCBBCBCBCCBBCC BCBBCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBC...
result:
wrong answer your plan fails on CCCCBBBB
Subtask #6:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 4ms
memory: 26568kb
input:
9
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBBBCBBBCBBCCBCBCBBBCBCBCBBCCBBBCBCBBCBCCBBCCBCBCBBCCBBBCBCCBCCBCBBBCBCCCBCBCBBCCBCCCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBC BBCBBBCBCBCCBBCCBBCBBBCBCBCCCBCBCBCCBBCCCBC...
result:
wrong answer your plan fails on CCCCBBBBB
Subtask #7:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 4ms
memory: 28884kb
input:
10
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...
result:
wrong answer your plan fails on CCCCBBBBBB
Subtask #8:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 29060kb
input:
11
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBBBCBBBCBBCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBBCCBCBCBBCCBBBCBCCBCCBCBBBCBCCCBCBCBBCCBCCCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBB...
result:
wrong answer your plan fails on CCCCBBBBBBB
Subtask #9:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 7ms
memory: 30536kb
input:
12
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...
result:
wrong answer your plan fails on CCCCBBBBBBBB
Subtask #10:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 11ms
memory: 33864kb
input:
13
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBBBCBBBCBBCCBCBCBBCCBCBCBBCCBBBCBCCBCBCCBBCCBCBCBBCCBBBCBCCBCCBCBBBCBCCCBCBBCBCCBCBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBB...
result:
wrong answer your plan fails on CCCCBBBBBBBBB
Subtask #11:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 7ms
memory: 40204kb
input:
14
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...
result:
wrong answer your plan fails on CCCCBBBBBBBBBB
Subtask #12:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 29ms
memory: 45408kb
input:
15
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBBBCBBBCBBCCBCBCBBCCBCBCBBCCBBBCBCCBCBCCBBCCBCBCBBCCBBBCBCCBCCBCBBBCBCCCBCBBCBCCBCBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBB...
result:
wrong answer your plan fails on CCCCBBBBBBBBBBB
Subtask #13:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 52ms
memory: 74580kb
input:
16
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...
result:
wrong answer your plan fails on CCCCBBBBBBBBBBBB
Subtask #14:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 150ms
memory: 97912kb
input:
17
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCBCBBCCBBBCBCCBCBCCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBBBCBBBCBBCCBCBCBBCCBCBCBBCCBBBCBCCBCBCCBBCCBCBCBBCCBBBCBCCBCCBCBBBCBCCCBCBBCBCCBCBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBBCBCBCBBCCBCBCBBCCBBCCBCBCBCCCBBCCBCCCBCCCBCBCBBBCBCCCBCCBCCBCBBCCBCBCBBBCBCCCBB...
result:
wrong answer your plan fails on CCCCBBBBBBBBBBBBB
Subtask #15:
score: 0
Wrong Answer
Test #15:
score: 0
Wrong Answer
time: 376ms
memory: 231200kb
input:
18
output:
BCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCBCBBCCBCBCBBBCBBBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCBCCBCBBCCBCBCBBCCBCBCBBBCBBCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCCCBCCCBCBCBBCCBCBCBBCCBCBCBB...
result:
wrong answer your plan fails on CCCCBBBBBBBBBBBBBB