QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#120943 | #4327. Šeširi | zhouhuanyi# | 100 ✓ | 314ms | 7692kb | C++11 | 1021b | 2023-07-07 12:50:19 | 2024-07-04 00:29:06 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cmath>
#define N 18
using namespace std;
int read()
{
char c=0;
int sum=0;
while (c<'0'||c>'9') c=getchar();
while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
return sum;
}
int n,delta[N+1];
char c[N+1][1<<N];
int main()
{
int cnt,rst,cnt2,d;
n=read();
for (int i=1;i<=n;++i)
for (int j=0;j<(1<<(n-1));++j)
{
cnt=cnt2=d=0;
for (int k=n;k>=1;--k)
if (i!=k)
delta[k]=(j>>cnt)&1,cnt++;
cnt=cnt2=0;
for (int k=1;k<=n;++k)
if (i!=k)
{
if (!delta[k]) cnt++;
else cnt2++;
}
if (cnt<cnt2)
{
rst=i;
for (int k=1;k<=n;++k)
if (i!=k&&!delta[k])
rst+=k+(i<k);
}
else
{
rst=i;
for (int k=1;k<=n;++k)
if (i!=k&&delta[k])
rst+=k+(i<k);
}
c[i][j]=(!(rst&1))?'B':'C';
}
for (int i=1;i<=n;++i)
{
for (int j=0;j<(1<<(n-1));++j) printf("%c",c[i][j]);
puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 0ms
memory: 5664kb
input:
4
output:
CBCBBCBC BCBCCBCB CBCBBCBC BCBCCBCB
result:
ok good plan!
Subtask #2:
score: 7
Accepted
Test #2:
score: 7
Accepted
time: 1ms
memory: 5776kb
input:
5
output:
CCBBCCBBBBCCBBCC BBCCBBCCCCBBCCBB CCBBCCBBBBCCBBCC BBCCBBCCCCBBCCBB CCBBCCBBBBCCBBCC
result:
ok good plan!
Subtask #3:
score: 7
Accepted
Test #3:
score: 7
Accepted
time: 1ms
memory: 5688kb
input:
6
output:
CBCBBCBBCBCCBBCBBCBBCCBCBBCBBCBC BCBCCBCCBCBBCCBCCBCCBBCBCCBCCBCB CBCBBCBBCBCCBBCBBCBBCCBCBBCBBCBC BCBCCBCCBCBBCCBCCBCCBBCBCCBCCBCB CBCBBCBBCBCCBBCBBCBBCCBCBBCBBCBC BCBCCBCCBCBBCCBCCBCCBBCBCCBCCBCB
result:
ok good plan!
Subtask #4:
score: 7
Accepted
Test #4:
score: 7
Accepted
time: 0ms
memory: 3692kb
input:
7
output:
CCBBCCBBBBCCBBCBCCBBCCBCBBCBBCBBBBCCBBCBCCBCCBCCBBCBBCBBCBCCBBCC BBCCBBCCCCBBCCBCBBCCBBCBCCBCCBCCCCBBCCBCBBCBBCBBCCBCCBCCBCBBCCBB CCBBCCBBBBCCBBCBCCBBCCBCBBCBBCBBBBCCBBCBCCBCCBCCBBCBBCBBCBCCBBCC BBCCBBCCCCBBCCBCBBCCBBCBCCBCCBCCCCBBCCBCBBCBBCBBCCBCCBCCBCBBCCBB CCBBCCBBBBCCBBCBCCBBCCBCBBCBBCBBBBCCBBCB...
result:
ok good plan!
Subtask #5:
score: 7
Accepted
Test #5:
score: 7
Accepted
time: 1ms
memory: 5660kb
input:
8
output:
CBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBC BCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCB CBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCB...
result:
ok good plan!
Subtask #6:
score: 7
Accepted
Test #6:
score: 7
Accepted
time: 1ms
memory: 5684kb
input:
9
output:
CCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCC BBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBC...
result:
ok good plan!
Subtask #7:
score: 7
Accepted
Test #7:
score: 7
Accepted
time: 1ms
memory: 5596kb
input:
10
output:
CBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCCBCBBCCBCBCBCCBCBBCBCCBCCCBCBBCBBCBCCBBCBBCBCCBCCBCBBCCBCCBCCBBCBCCBCCBCBCBCBBCBCCBCBBCBBBCBCCBCCBCBBCCBCCBCBBCBBCBCCBBCBBCBBCCBCBBCBBCBCBCBCCBCCBCBBCCBCCBCCBBCBCCBCCBCBBCBBCCBCBBCBBCBCCCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCCCBCBBCBBCBCCBBCBBCBCCBCCBCBB...
result:
ok good plan!
Subtask #8:
score: 7
Accepted
Test #8:
score: 7
Accepted
time: 0ms
memory: 5652kb
input:
11
output:
CCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCBBBCCBBCCCCBBCCBCBBCCBBCBCCBCCBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBCCCBBCCBBBBCCBBCBCCBBCCBCBBCBBCBBBBCCBBCCCCBBCCBCBBCCBBCBCCBCCBCCCCBBCCBCBBCBBCBBCCBCCBCCBCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCBBBCCBBCCCCBB...
result:
ok good plan!
Subtask #9:
score: 7
Accepted
Test #9:
score: 7
Accepted
time: 4ms
memory: 5692kb
input:
12
output:
CBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBC...
result:
ok good plan!
Subtask #10:
score: 7
Accepted
Test #10:
score: 7
Accepted
time: 7ms
memory: 7692kb
input:
13
output:
CCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBB...
result:
ok good plan!
Subtask #11:
score: 6
Accepted
Test #11:
score: 6
Accepted
time: 13ms
memory: 5732kb
input:
14
output:
CBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBBCBCCBBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBC...
result:
ok good plan!
Subtask #12:
score: 6
Accepted
Test #12:
score: 6
Accepted
time: 33ms
memory: 5848kb
input:
15
output:
CCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBB...
result:
ok good plan!
Subtask #13:
score: 6
Accepted
Test #13:
score: 6
Accepted
time: 68ms
memory: 5944kb
input:
16
output:
CBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBC...
result:
ok good plan!
Subtask #14:
score: 6
Accepted
Test #14:
score: 6
Accepted
time: 150ms
memory: 6288kb
input:
17
output:
CCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBCCBBCCBBCCCCBB...
result:
ok good plan!
Subtask #15:
score: 6
Accepted
Test #15:
score: 6
Accepted
time: 314ms
memory: 6976kb
input:
18
output:
CBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBCCBCBCBCBBCBCCBCBBCBCBCBCCBCBBCBC...
result:
ok good plan!
Extra Test:
score: 0
Extra Test Passed