QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#120914 | #4327. Šeširi | He_Ren | 7 | 1ms | 3640kb | C++17 | 982b | 2023-07-07 12:35:06 | 2023-07-07 12:35:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define bbit(i) (1<<(i))
#define bdig(x,i) (((x)>>(i))&1)
mt19937 gen(114514);
int main(void)
{
int n;
scanf("%d",&n);
vector< vector<int> > a(n, vector<int>(1 << (n-1)));
auto check = [&] (void) -> bool
{
for(int mask=0; mask<(1<<n); ++mask)
{
int cnt[2] = {0,0};
int ok[2] = {0,0};
for(int i=0; i<n; ++i)
{
int cur = 0;
for(int j=0; j<n; ++j) if(i != j)
cur = cur << 1 | bdig(mask, j);
int x = bdig(mask, i);
int y = a[i][cur];
++cnt[x];
ok[x] += x == y;
}
if(ok[0] < cnt[0] / 2) return 0;
if(ok[1] < cnt[1] / 2) return 0;
}
return 1;
};
do
{
for(auto &t: a)
for(auto &tt: t)
tt = gen() % 2;
}while(!check());
for(int i=0; i<n; ++i)
{
for(int j=0; j<(1<<(n-1)); ++j)
putchar(a[i][j] + 'B');
printf("\n");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 1ms
memory: 3640kb
input:
4
output:
BCCBBCBB CBCBCBBC BCBBBBCB CBCCBCBC
result:
ok good plan!
Subtask #2:
score: 0
Time Limit Exceeded
Test #2:
score: 0
Time Limit Exceeded
input:
5
output:
result:
Subtask #3:
score: 0
Time Limit Exceeded
Test #3:
score: 0
Time Limit Exceeded
input:
6
output:
result:
Subtask #4:
score: 0
Time Limit Exceeded
Test #4:
score: 0
Time Limit Exceeded
input:
7
output:
result:
Subtask #5:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded
input:
8
output:
result:
Subtask #6:
score: 0
Time Limit Exceeded
Test #6:
score: 0
Time Limit Exceeded
input:
9
output:
result:
Subtask #7:
score: 0
Time Limit Exceeded
Test #7:
score: 0
Time Limit Exceeded
input:
10
output:
result:
Subtask #8:
score: 0
Time Limit Exceeded
Test #8:
score: 0
Time Limit Exceeded
input:
11
output:
result:
Subtask #9:
score: 0
Time Limit Exceeded
Test #9:
score: 0
Time Limit Exceeded
input:
12
output:
result:
Subtask #10:
score: 0
Time Limit Exceeded
Test #10:
score: 0
Time Limit Exceeded
input:
13
output:
result:
Subtask #11:
score: 0
Time Limit Exceeded
Test #11:
score: 0
Time Limit Exceeded
input:
14
output:
result:
Subtask #12:
score: 0
Time Limit Exceeded
Test #12:
score: 0
Time Limit Exceeded
input:
15
output:
result:
Subtask #13:
score: 0
Time Limit Exceeded
Test #13:
score: 0
Time Limit Exceeded
input:
16
output:
result:
Subtask #14:
score: 0
Time Limit Exceeded
Test #14:
score: 0
Time Limit Exceeded
input:
17
output:
result:
Subtask #15:
score: 0
Time Limit Exceeded
Test #15:
score: 0
Time Limit Exceeded
input:
18