QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#120915 | #4327. Šeširi | Laurie# | 53 | 311ms | 37532kb | C++14 | 3.1kb | 2023-07-07 12:37:08 | 2024-07-04 00:28:28 |
Judging History
answer
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
#define vi vector<int>
#define ull unsigned long long
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
template<class T>
inline void read(T &x) {
x=0;
bool fu=0;
char ch=0;
while(ch>'9'||ch<'0') {
ch=getchar();
if(ch=='-')fu=1;
}
while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
if(fu)x=-x;
}
inline int read() {
int x=0;
bool fu=0;
char ch=0;
while(ch>'9'||ch<'0') {
ch=getchar();
if(ch=='-')fu=1;
}
while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
return fu?-x:x;
}
template<class T,class... Args>
inline void read(T& t,Args&... args) {
read(t);
read(args...);
}
char _n_u_m_[40];
template<class T>
inline void write(T x) {
if(x==0){
putchar('0');
return;
}
T tmp = x > 0 ? x : -x ;
if( x < 0 ) putchar('-') ;
register int cnt = 0 ;
while( tmp > 0 ) {
_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
tmp /= 10 ;
}
while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
}
template<class T>
inline void write(T x ,char ch) {
write(x);
putchar(ch);
}
}
using namespace fastIO;
int nn,n;
inline pair<vector<int>,vector<vector<int>>> solve(int n){
if(n==2){
return make_pair(vector<int>{0,1,-1,0},vector<vector<int>>{vector<int>{false,true},vector<int>{false,false},vector<int>{true,true},vector<int>{true,false}});
}
auto t1=solve(n-2),t2=solve(2);
pair<vector<int>,vector<vector<int>>>ans;
F(j,0,3)F(i,0,(1<<(n-2))-1){
vector<int>temp;
for(auto &k:t1.second[i])temp.push_back(k^(t2.first[j]==1));
for(auto &k:t2.second[j])temp.push_back(k^(t1.first[i]==-1));
ans.first.push_back(t1.first[i]*(t2.first[j]==1?-1:1)+t2.first[j]*(t1.first[i]==-1?-1:1));
ans.second.push_back(temp);
}
return ans;
}
inline int rev(int x){
int res=0;
F(i,0,n-1)res|=(x>>i&1)<<(n-i-1);
return res;
}
int main() {
cin>>nn;
n=nn;
if(n&1)--n;
auto ans=solve(n).second;
F(i,0,n-1){
F(j,0,(1<<n)-1)if(rev(j)>>i&1){
putchar(ans[rev(j)][i]?'C':'B');
}
// UF(j,(1<<n)-1,0)if(j>>i&1){
// putchar(ans[j][i]?'1':'0');
// }
if(nn&1){
F(j,0,(1<<n)-1)if(j>>i&1){
putchar(ans[j][i]?'C':'B');
}
}
putchar('\n');
}
return 0;
}
详细
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 0ms
memory: 3592kb
input:
4
output:
BBCBCCBC CCBCBBCB BCCBBCBC CBBCCBCB
result:
ok good plan!
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
5
output:
BBCBCCBCBCCBBCBC CCBCBBCBCBBCCBCB BCCBBCBCBBCBCCBC CBBCCBCBCCBCBBCB
result:
wrong output format Unexpected end of file - token expected
Subtask #3:
score: 7
Accepted
Test #3:
score: 7
Accepted
time: 0ms
memory: 3744kb
input:
6
output:
BBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBC CCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCB BBCBCCBCCCBCBBCBBBCBCCBCBBCBCCBC CCBCBBCBBBCBCCBCCCBCBBCBCCBCBBCB BCCBBCBCCBBCBCCBBCBCBCBCBCCBBCBC CBBCCBCBBCCBCBBCCBCBCBCBCBBCCBCB
result:
ok good plan!
Subtask #4:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3772kb
input:
7
output:
BBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBCCBBCBCCBBCCBCBBCCBBCBCBCCBBCBC CCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCBBCCBCBBCCBBCBCCBBCCBCBCBBCCBCB BBCBCCBCCCBCBBCBBBCBCCBCBBCBCCBCBBCBCCBCCCBCBBCBBBCBCCBCBBCBCCBC CCBCBBCBBBCBCCBCCCBCBBCBCCBCBBCBCCBCBBCBBBCBCCBCCCBCBBCBCCBCBBCB BCCBBCBCCBBCBCCBBCBCBCBCBCCBBCBCBBCBBBBB...
result:
wrong output format Unexpected end of file - token expected
Subtask #5:
score: 7
Accepted
Test #5:
score: 7
Accepted
time: 0ms
memory: 3824kb
input:
8
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBC CCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCB BBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBB...
result:
ok good plan!
Subtask #6:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
input:
9
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBCCBBCBCCBBCCBCBBCCBBCBCBCCBBCBCCBBCCBCBBCCBBCBCCBBCCBCBCBBCCBCBBCCBBCBCCBBCCBCBBCCBBCBCBCCBBCBCBCCBBCBCCBBCCBCBBCCBBCBCBCCBBCBC CCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCB...
result:
wrong output format Unexpected end of file - token expected
Subtask #7:
score: 7
Accepted
Test #7:
score: 7
Accepted
time: 1ms
memory: 3676kb
input:
10
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBC...
result:
ok good plan!
Subtask #8:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 3616kb
input:
11
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBC...
result:
wrong output format Unexpected end of file - token expected
Subtask #9:
score: 7
Accepted
Test #9:
score: 7
Accepted
time: 2ms
memory: 3704kb
input:
12
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...
result:
ok good plan!
Subtask #10:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 2ms
memory: 3820kb
input:
13
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...
result:
wrong output format Unexpected end of file - token expected
Subtask #11:
score: 6
Accepted
Test #11:
score: 6
Accepted
time: 8ms
memory: 5036kb
input:
14
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...
result:
ok good plan!
Subtask #12:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 8ms
memory: 4968kb
input:
15
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...
result:
wrong output format Unexpected end of file - token expected
Subtask #13:
score: 6
Accepted
Test #13:
score: 6
Accepted
time: 42ms
memory: 11492kb
input:
16
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...
result:
ok good plan!
Subtask #14:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 42ms
memory: 11576kb
input:
17
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...
result:
wrong output format Unexpected end of file - token expected
Subtask #15:
score: 6
Accepted
Test #15:
score: 6
Accepted
time: 311ms
memory: 37532kb
input:
18
output:
BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...
result:
ok good plan!