QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#120923#4327. ŠeširiLaurie#100 ✓326ms57600kbC++143.2kb2023-07-07 12:41:102024-07-04 00:28:36

Judging History

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

  • [2024-07-04 00:28:36]
  • 评测
  • 测评结果:100
  • 用时:326ms
  • 内存:57600kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-07 12:41:10]
  • 提交

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 temp=solve(n);
	auto ans=temp.second;
	F(i,0,n-1){
		F(j,0,(1<<n)-1)if(rev(j)>>i&1){
			putchar(ans[rev(j)][i]?'C':'B');
			if(nn&1)putchar(ans[rev(j)][i]?'C':'B');
		}
		putchar('\n');
	}
	if(nn&1){
		F(i,0,(1<<n)-1){
			if(temp.first[rev(i)]==1)putchar('C');
			else putchar('B');
		}
		putchar('\n');
	}
	return 0;
}


详细

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 0ms
memory: 3600kb

input:

4

output:

BBCBCCBC
CCBCBBCB
BCCBBCBC
CBBCCBCB

result:

ok good plan!

Subtask #2:

score: 7
Accepted

Test #2:

score: 7
Accepted
time: 0ms
memory: 3520kb

input:

5

output:

BBBBCCBBCCCCBBCC
CCCCBBCCBBBBCCBB
BBCCCCBBBBCCBBCC
CCBBBBCCCCBBCCBB
BBCBBBBBCBBCBBCB

result:

ok good plan!

Subtask #3:

score: 7
Accepted

Test #3:

score: 7
Accepted
time: 0ms
memory: 3548kb

input:

6

output:

BBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBC
CCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCB
BBCBCCBCCCBCBBCBBBCBCCBCBBCBCCBC
CCBCBBCBBBCBCCBCCCBCBBCBCCBCBBCB
BCCBBCBCCBBCBCCBBCBCBCBCBCCBBCBC
CBBCCBCBBCCBCBBCCBCBCBCBCBBCCBCB

result:

ok good plan!

Subtask #4:

score: 7
Accepted

Test #4:

score: 7
Accepted
time: 0ms
memory: 3584kb

input:

7

output:

BBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCC
CCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBB
BBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCC
CCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBB
BBCCCCBBBBCCBBCCCCBBBBCCBBCCCCBBBBCCBBCC...

result:

ok good plan!

Subtask #5:

score: 7
Accepted

Test #5:

score: 7
Accepted
time: 0ms
memory: 3616kb

input:

8

output:

BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBC
CCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCB
BBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBB...

result:

ok good plan!

Subtask #6:

score: 7
Accepted

Test #6:

score: 7
Accepted
time: 0ms
memory: 3636kb

input:

9

output:

BBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCC
CCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCCCC...

result:

ok good plan!

Subtask #7:

score: 7
Accepted

Test #7:

score: 7
Accepted
time: 1ms
memory: 3748kb

input:

10

output:

BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBC...

result:

ok good plan!

Subtask #8:

score: 7
Accepted

Test #8:

score: 7
Accepted
time: 1ms
memory: 3724kb

input:

11

output:

BBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCCCCC...

result:

ok good plan!

Subtask #9:

score: 7
Accepted

Test #9:

score: 7
Accepted
time: 2ms
memory: 4256kb

input:

12

output:

BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...

result:

ok good plan!

Subtask #10:

score: 7
Accepted

Test #10:

score: 7
Accepted
time: 2ms
memory: 4316kb

input:

13

output:

BBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCCCCC...

result:

ok good plan!

Subtask #11:

score: 6
Accepted

Test #11:

score: 6
Accepted
time: 9ms
memory: 6000kb

input:

14

output:

BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...

result:

ok good plan!

Subtask #12:

score: 6
Accepted

Test #12:

score: 6
Accepted
time: 11ms
memory: 5908kb

input:

15

output:

BBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCCCCC...

result:

ok good plan!

Subtask #13:

score: 6
Accepted

Test #13:

score: 6
Accepted
time: 41ms
memory: 16888kb

input:

16

output:

BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...

result:

ok good plan!

Subtask #14:

score: 6
Accepted

Test #14:

score: 6
Accepted
time: 73ms
memory: 16888kb

input:

17

output:

BBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCBBBBCCBBBBBBCCBBCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCBBBBCCBBCCCCBBCCCCCCBBCCCCCC...

result:

ok good plan!

Subtask #15:

score: 6
Accepted

Test #15:

score: 6
Accepted
time: 326ms
memory: 57600kb

input:

18

output:

BBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCBCCBCBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBBBCBBBCBCCBCBBCBCCBCCCBCBBCB...

result:

ok good plan!

Extra Test:

score: 0
Extra Test Passed