QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527604#4327. Šeširisio_0 101ms51692kbC++141.6kb2024-08-22 17:33:432024-08-22 17:33:43

Judging History

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

  • [2024-08-22 17:33:43]
  • 评测
  • 测评结果:0
  • 用时:101ms
  • 内存:51692kb
  • [2024-08-22 17:33:43]
  • 提交

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

output:


result: