QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527601#4327. Šeširisio_0 100ms51288kbC++141.6kb2024-08-22 17:31:332024-08-22 17:31:34

Judging History

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

  • [2024-08-22 17:31:34]
  • 评测
  • 测评结果:0
  • 用时:100ms
  • 内存:51288kb
  • [2024-08-22 17:31:33]
  • 提交

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=0;k<(1<<n);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: 11068kb

input:

4

output:

CBCBCBCB
BCBCBCBC
CBBBBCCC
BCCCCBBB

result:

wrong answer your plan fails on CCCB

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

5

output:

CBCBCBCBCBCBCBCB
BCBCBCBCBCBCBCBC
CCCCBBBBCCCCBBBB
BBBBCCCCBBBBCCCC
CCCCCCCCCCCCCCCC

result:

wrong answer your plan fails on CCBBB

Subtask #3:

score: 0
Wrong Answer

Test #3:

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

input:

6

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC
CBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCC
BCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBB
CCCCBCCCBBBBBCCCBBBBCBBBCCCCCBBB
BBBBCBBBCCCCCBBBCCCCBCCCBBBBBCCC

result:

wrong answer your plan fails on CCCBBB

Subtask #4:

score: 0
Wrong Answer

Test #4:

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

input:

7

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC
CCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBB
BBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCC
CCCCCCCCCCCCCCCCBBBBBBBBBBBBBBBBCCCCCCCC...

result:

wrong answer your plan fails on CCBBBBB

Subtask #5:

score: 0
Wrong Answer

Test #5:

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

input:

8

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC
CBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCBBBBCCCCB...

result:

wrong answer your plan fails on CCCCBBBB

Subtask #6:

score: 0
Wrong Answer

Test #6:

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

input:

9

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB
BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB...

result:

wrong answer your plan fails on CCBBBBBBB

Subtask #7:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 4ms
memory: 11620kb

input:

10

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB...

result:

wrong answer your plan fails on CCCCBBBBBB

Subtask #8:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 5ms
memory: 12804kb

input:

11

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB...

result:

wrong answer your plan fails on CCBBBBBBBBB

Subtask #9:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 7ms
memory: 15396kb

input:

12

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB...

result:

wrong answer your plan fails on CCCCBBBBBBBB

Subtask #10:

score: 0
Wrong Answer

Test #10:

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

input:

13

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB...

result:

wrong answer your plan fails on CCBBBBBBBBBBB

Subtask #11:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 42ms
memory: 24436kb

input:

14

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB...

result:

wrong answer your plan fails on CCCCBBBBBBBBBB

Subtask #12:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 100ms
memory: 51288kb

input:

15

output:

CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB...

result:

wrong answer your plan fails on CCBBBBBBBBBBBBB

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: