QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527604 | #4327. Šeširi | sio_ | 0 | 101ms | 51692kb | C++14 | 1.6kb | 2024-08-22 17:33:43 | 2024-08-22 17:33:43 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+5;
int n,cnt,vis[maxn],tim[maxn];
int flag[maxn];
map<pair<int,int>,int> mp;
vector<int> ans;
vector<pair<int,int>> nbr[maxn];
void dfs(int cur)
{
ans.push_back(cur);
for(int i=tim[cur];i<nbr[cur].size();i=tim[cur])
{
tim[cur]++;
int nxt=nbr[cur][i].first;
if(vis[nbr[cur][i].second]==1) continue;
vis[nbr[cur][i].second]=1;
dfs(nxt);
}
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
for(int k=0;k<(1<<n);k++)
{
if(((k>>i)&1)==1) continue;
nbr[k].push_back({k+(1<<i),++cnt});
nbr[k+(1<<i)].push_back({k,cnt});
}
for(int k=0;k<(1<<n);k++)
{
if(nbr[k].size()%2==0) continue;
nbr[k].push_back({(1<<n),++cnt});
nbr[(1<<n)].push_back({k,cnt});
}
nbr[(1<<n)].push_back({0,++cnt});
nbr[0].push_back({(1<<n),cnt});
nbr[(1<<n)].push_back({0,++cnt});
nbr[0].push_back({(1<<n),cnt});
dfs((1<<n));
// for(int i=0;i<ans.size();i++) cout<<ans[i]<<" ";
int x=ans.back();ans.pop_back();
while(!ans.empty())
{
int now=ans.back();ans.pop_back();
if(now!=(1<<n)&&x!=(1<<n))
{
if((x&(x^now))==0) mp[{x,now}]=1;
else mp[{now,x}]=0;
}
x=now;
}
for(int i=0;i<n;i++)
{
for(int k=(1<<n)-1;k>=0;k--)
{
if(((k>>i)&1)==1) continue;
cout<<((mp[{k,k+(1<<i)}]==1)?'B':'C');
}
cout<<"\n";
}
}
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: 12256kb
input:
4
output:
BCBCBCBC CBCBCBCB CCCBBBBC BBBCCCCB
result:
wrong answer your plan fails on CCCB
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 2ms
memory: 12372kb
input:
5
output:
BCBCBCBCBCBCBCBC CBCBCBCBCBCBCBCB BBBBCCCCBBBBCCCC CCCCBBBBCCCCBBBB CCCCCCCCCCCCCCCC
result:
wrong answer your plan fails on CBBBB
Subtask #3:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 11252kb
input:
6
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB CCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBC BBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCB BBBCCCCCBBBCBBBBCCCBBBBBCCCBCCCC CCCBBBBBCCCBCCCCBBBCCCCCBBBCBBBB
result:
wrong answer your plan fails on CCCBBB
Subtask #4:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 2ms
memory: 12588kb
input:
7
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB BBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCC CCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBB BBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCBBBBBBBB...
result:
wrong answer your plan fails on CBBBBBB
Subtask #5:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 2ms
memory: 12036kb
input:
8
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB CCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCC...
result:
wrong answer your plan fails on CCCCBBBB
Subtask #6:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 11572kb
input:
9
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on CBBBBBBBB
Subtask #7:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 3ms
memory: 11676kb
input:
10
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on CCCCBBBBBB
Subtask #8:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 5ms
memory: 12852kb
input:
11
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on CBBBBBBBBBB
Subtask #9:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 11ms
memory: 15088kb
input:
12
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on CCCCBBBBBBBB
Subtask #10:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 23ms
memory: 20500kb
input:
13
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on CBBBBBBBBBBBB
Subtask #11:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 41ms
memory: 23232kb
input:
14
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on CCCCBBBBBBBBBB
Subtask #12:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 101ms
memory: 51692kb
input:
15
output:
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC...
result:
wrong answer your plan fails on CBBBBBBBBBBBBBB
Subtask #13:
score: 0
Runtime Error
Test #13:
score: 0
Runtime Error
input:
16
output:
result:
Subtask #14:
score: 0
Runtime Error
Test #14:
score: 0
Runtime Error
input:
17
output:
result:
Subtask #15:
score: 0
Runtime Error
Test #15:
score: 0
Runtime Error
input:
18