QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#621938 | #6602. Journey to Un'Goro | 552Hz | WA | 57ms | 10488kb | C++14 | 5.1kb | 2024-10-08 18:31:37 | 2024-10-08 18:31:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int N=200010;
const ll mod=998244353;
//const ll mod=1e9+7;
ll n;
int cnt[100];
ll clac(){
ll ct=0,c[2];
memset(c,0,sizeof c);
c[0]++;
for(int i=1;i<=n;i++){
if(cnt[i]%2==0){
ct+=c[1];
}else{
ct+=c[0];
}
c[cnt[i]%2]++;
}
return ct;
}
string s[110];
void init(){
s[1]="bbbbbbbbbbbbbr";
s[2]="bbbbbbbbbbbbrb";
s[3]="bbbbbbbbbbbbrr";
s[4]="bbbbbbbbbbbrbr";
s[5]="bbbbbbbbbbbrrb";
s[6]="bbbbbbbbbbbrrr";
s[7]="bbbbbbbbbbrbrb";
s[8]="bbbbbbbbbbrrbb";
s[9]="bbbbbbbbbbrrbr";
s[10]="bbbbbbbbbbrrrr";
s[11]="bbbbbbbbbrbrbb";
s[12]="bbbbbbbbbrrbbb";
s[13]="bbbbbbbbbrrbbr";
s[14]="bbbbbbbbbrrbrr";
s[15]="bbbbbbbbbrrrrb";
s[16]="bbbbbbbbrbrbbb";
s[17]="bbbbbbbbrrbbbb";
s[18]="bbbbbbbbrrbbbr";
s[19]="bbbbbbbbrrbbrr";
s[20]="bbbbbbbbrrbrrb";
s[21]="bbbbbbbbrrrrbb";
s[22]="bbbbbbbrbrbbbb";
s[23]="bbbbbbbrrbbbbb";
s[24]="bbbbbbbrrbbbbr";
s[25]="bbbbbbbrrbbbrr";
s[26]="bbbbbbbrrbbrrb";
s[27]="bbbbbbbrrbrrbb";
s[28]="bbbbbbbrrrrbbb";
s[29]="bbbbbbrbrbbbbb";
s[30]="bbbbbbrrbbbbbb";
s[31]="bbbbbbrrbbbbbr";
s[32]="bbbbbbrrbbbbrr";
s[33]="bbbbbbrrbbbrrb";
s[34]="bbbbbbrrbbrrbb";
s[35]="bbbbbbrrbrrbbb";
s[36]="bbbbbbrrrrbbbb";
s[37]="bbbbbrbrbbbbbb";
s[38]="bbbbbrrbbbbbbb";
s[39]="bbbbbrrbbbbbbr";
s[40]="bbbbbrrbbbbbrr";
s[41]="bbbbbrrbbbbrrb";
s[42]="bbbbbrrbbbrrbb";
s[43]="bbbbbrrbbrrbbb";
s[44]="bbbbbrrbrrbbbb";
s[45]="bbbbbrrrrbbbbb";
s[46]="bbbbrbrbbbbbbb";
s[47]="bbbbrrbbbbbbbb";
s[48]="bbbbrrbbbbbbbr";
s[49]="bbbbrrbbbbbbrr";
s[50]="bbbbrrbbbbbrrb";
s[51]="bbbbrrbbbbrrbb";
s[52]="bbbbrrbbbrrbbb";
s[53]="bbbbrrbbrrbbbb";
s[54]="bbbbrrbrrbbbbb";
s[55]="bbbbrrrrbbbbbb";
s[56]="bbbrbrbbbbbbbb";
s[57]="bbbrrbbbbbbbbb";
s[58]="bbbrrbbbbbbbbr";
s[59]="bbbrrbbbbbbbrr";
s[60]="bbbrrbbbbbbrrb";
s[61]="bbbrrbbbbbrrbb";
s[62]="bbbrrbbbbrrbbb";
s[63]="bbbrrbbbrrbbbb";
s[64]="bbbrrbbrrbbbbb";
s[65]="bbbrrbrrbbbbbb";
s[66]="bbbrrrrbbbbbbb";
s[67]="bbrbrbbbbbbbbb";
s[68]="bbrrbbbbbbbbbb";
s[69]="bbrrbbbbbbbbbr";
s[70]="bbrrbbbbbbbbrr";
s[71]="bbrrbbbbbbbrrb";
s[72]="bbrrbbbbbbrrbb";
s[73]="bbrrbbbbbrrbbb";
s[74]="bbrrbbbbrrbbbb";
s[75]="bbrrbbbrrbbbbb";
s[76]="bbrrbbrrbbbbbb";
s[77]="bbrrbrrbbbbbbb";
s[78]="bbrrrrbbbbbbbb";
s[79]="brbrbbbbbbbbbb";
s[80]="brrbbbbbbbbbbb";
s[81]="brrbbbbbbbbbbr";
s[82]="brrbbbbbbbbbrr";
s[83]="brrbbbbbbbbrrb";
s[84]="brrbbbbbbbrrbb";
s[85]="brrbbbbbbrrbbb";
s[86]="brrbbbbbrrbbbb";
s[87]="brrbbbbrrbbbbb";
s[88]="brrbbbrrbbbbbb";
s[89]="brrbbrrbbbbbbb";
s[90]="brrbrrbbbbbbbb";
s[91]="brrrrbbbbbbbbb";
s[92]="rbrbbbbbbbbbbb";
s[93]="rrbbbbbbbbbbbb";
s[94]="rrbbbbbbbbbbbr";
s[95]="rrbbbbbbbbbbrr";
s[96]="rrbbbbbbbbbrrb";
s[97]="rrbbbbbbbbrrbb";
s[98]="rrbbbbbbbrrbbb";
}
void solve(){
cin>>n;
ll ans;
if(n%2==0){
ans=(n/2+1)*(n/2);
}else{
ans=(n/2+1)*(n/2+1);
}
cout<<ans<<endl;
if(n<=18){
std::vector<string> q;
//bool flag=0;
for(int i=0;i<(1<<n);i++){
for(int j=0;j<=n;j++){
cnt[j]=0;
}
for(int j=0;j<n;j++){
if((1<<j)&i){
cnt[j+1]=1;
}
cnt[j+1]+=cnt[j];
}
if(clac()==ans){
string node;
for(int j=1;j<=n;j++){
if(cnt[j]-cnt[j-1]==1){
node.push_back('r');
}else{
node.push_back('b');
}
}
q.push_back(node);
}
}
sort(q.begin(),q.end());
//cout<<q.size()<<endl;
int cnt=0;
for(auto v:q){
cout<<v<<endl;
cnt++;
if(cnt>=100){
break;
}
}
return;
}
if(n<=40){
vector<string> q;
string no(n,'b');
no[n/2]='r';
q.push_back(no);
for(int p=(n)/2;p>=1;p--){
for(int i=0;i<(1<<(n-p));i++){
for(int j=0;j<=n;j++){
cnt[j]=0;
}
cnt[p]=1;
for(int j=0;j<(n-p);j++){
if(i&(1<<j)){
cnt[p+j+1]=1;
}
//cnt[p+j+1]+=cnt[p+j];
}
for(int j=1;j<=n;j++){
cnt[j]+=cnt[j-1];
}
if(clac()==ans){
string node;
for(int j=1;j<=n;j++){
if(cnt[j]-cnt[j-1]==1){
node.push_back('r');
}else{
node.push_back('b');
}
}
q.push_back(node);
}
}
if(q.size()>=100){
break;
}
}
sort(q.begin(),q.end());
//cout<<q.size()<<endl;
int cnt=0;
for(auto v:q){
cout<<v<<endl;
cnt++;
if(cnt>=100){
break;
}
}
return;
}
int tot=0;
string node(n,'b');
node[n/2]='r';
++tot;
cout<<node<<endl;
for(auto &v:node){
v='b';
}
node[(n/2)-1]='r';
cout<<node<<endl;
++tot;
node[node.size()-1]='r';
cout<<node<<endl;
++tot;
node[node.size()-2]='r';
int ptr=node.size()-2;
cout<<node<<endl;
++tot;
ptr--;
while(ptr!=(n/2)-1){
node[ptr]='r';
node[ptr+2]='b';
cout<<node<<endl;
++tot;
if(tot>=100){
return;
}
ptr--;
}
for(auto &v:node){
v='b';
}
node[(n/2)-2]='r';
for(int i=1;i<=100-tot;i++){
cout<<node.substr(0,n-14)<<s[i]<<endl;
}
}
int main(){
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int _=1;
init();
while(_--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3600kb
input:
1
output:
1 r
result:
ok 2 tokens
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2
output:
2 br rb rr
result:
ok 4 tokens
Test #3:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
3
output:
4 brb rbr rrr
result:
ok 4 tokens
Test #4:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
4
output:
6 bbrb brbb brbr brrr rbbr rbrb rbrr rrbr rrrb rrrr
result:
ok 11 tokens
Test #5:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5
output:
9 bbrbb brbbr brbrr brrrb rbbrb rbrbr rbrrr rrbrb rrrbr rrrrr
result:
ok 11 tokens
Test #6:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
6
output:
12 bbbrbb bbrbbb bbrbbr bbrbrr bbrrrb brbbbr brbbrb brbbrr brbrbr brbrrb brbrrr brrbrb brrrbb brrrbr brrrrr rbbbrb rbbrbb rbbrbr rbbrrr rbrbbr rbrbrb rbrbrr rbrrbr rbrrrb rbrrrr rrbbrb rrbrbb rrbrbr rrbrrr rrrbbr rrrbrb rrrbrr rrrrbr rrrrrb rrrrrr
result:
ok 36 tokens
Test #7:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
7
output:
16 bbbrbbb bbrbbbr bbrbbrr bbrbrrb bbrrrbb brbbbrb brbbrbr brbbrrr brbrbrb brbrrbr brbrrrr brrbrbb brrrbbr brrrbrr brrrrrb rbbbrbb rbbrbbr rbbrbrr rbbrrrb rbrbbrb rbrbrbr rbrbrrr rbrrbrb rbrrrbr rbrrrrr rrbbrbb rrbrbbr rrbrbrr rrbrrrb rrrbbrb rrrbrbr rrrbrrr rrrrbrb rrrrrbr rrrrrrr
result:
ok 36 tokens
Test #8:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
8
output:
20 bbbbrbbb bbbrbbbb bbbrbbbr bbbrbbrr bbbrbrrb bbbrrrbb bbrbbbbr bbrbbbrb bbrbbbrr bbrbbrbr bbrbbrrb bbrbbrrr bbrbrbrb bbrbrrbb bbrbrrbr bbrbrrrr bbrrbrbb bbrrrbbb bbrrrbbr bbrrrbrr bbrrrrrb brbbbbrb brbbbrbb brbbbrbr brbbbrrr brbbrbbr brbbrbrb brbbrbrr brbbrrbr brbbrrrb brbbrrrr brbrbbrb brbrbrbb ...
result:
ok 101 tokens
Test #9:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
9
output:
25 bbbbrbbbb bbbrbbbbr bbbrbbbrr bbbrbbrrb bbbrbrrbb bbbrrrbbb bbrbbbbrb bbrbbbrbr bbrbbbrrr bbrbbrbrb bbrbbrrbr bbrbbrrrr bbrbrbrbb bbrbrrbbr bbrbrrbrr bbrbrrrrb bbrrbrbbb bbrrrbbbr bbrrrbbrr bbrrrbrrb bbrrrrrbb brbbbbrbb brbbbrbbr brbbbrbrr brbbbrrrb brbbrbbrb brbbrbrbr brbbrbrrr brbbrrbrb brbbrrr...
result:
ok 101 tokens
Test #10:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
10
output:
30 bbbbbrbbbb bbbbrbbbbb bbbbrbbbbr bbbbrbbbrr bbbbrbbrrb bbbbrbrrbb bbbbrrrbbb bbbrbbbbbr bbbrbbbbrb bbbrbbbbrr bbbrbbbrbr bbbrbbbrrb bbbrbbbrrr bbbrbbrbrb bbbrbbrrbb bbbrbbrrbr bbbrbbrrrr bbbrbrbrbb bbbrbrrbbb bbbrbrrbbr bbbrbrrbrr bbbrbrrrrb bbbrrbrbbb bbbrrrbbbb bbbrrrbbbr bbbrrrbbrr bbbrrrbrrb ...
result:
ok 101 tokens
Test #11:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
11
output:
36 bbbbbrbbbbb bbbbrbbbbbr bbbbrbbbbrr bbbbrbbbrrb bbbbrbbrrbb bbbbrbrrbbb bbbbrrrbbbb bbbrbbbbbrb bbbrbbbbrbr bbbrbbbbrrr bbbrbbbrbrb bbbrbbbrrbr bbbrbbbrrrr bbbrbbrbrbb bbbrbbrrbbr bbbrbbrrbrr bbbrbbrrrrb bbbrbrbrbbb bbbrbrrbbbr bbbrbrrbbrr bbbrbrrbrrb bbbrbrrrrbb bbbrrbrbbbb bbbrrrbbbbr bbbrrrbbb...
result:
ok 101 tokens
Test #12:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
12
output:
42 bbbbbbrbbbbb bbbbbrbbbbbb bbbbbrbbbbbr bbbbbrbbbbrr bbbbbrbbbrrb bbbbbrbbrrbb bbbbbrbrrbbb bbbbbrrrbbbb bbbbrbbbbbbr bbbbrbbbbbrb bbbbrbbbbbrr bbbbrbbbbrbr bbbbrbbbbrrb bbbbrbbbbrrr bbbbrbbbrbrb bbbbrbbbrrbb bbbbrbbbrrbr bbbbrbbbrrrr bbbbrbbrbrbb bbbbrbbrrbbb bbbbrbbrrbbr bbbbrbbrrbrr bbbbrbbrrrr...
result:
ok 101 tokens
Test #13:
score: 0
Accepted
time: 2ms
memory: 3724kb
input:
13
output:
49 bbbbbbrbbbbbb bbbbbrbbbbbbr bbbbbrbbbbbrr bbbbbrbbbbrrb bbbbbrbbbrrbb bbbbbrbbrrbbb bbbbbrbrrbbbb bbbbbrrrbbbbb bbbbrbbbbbbrb bbbbrbbbbbrbr bbbbrbbbbbrrr bbbbrbbbbrbrb bbbbrbbbbrrbr bbbbrbbbbrrrr bbbbrbbbrbrbb bbbbrbbbrrbbr bbbbrbbbrrbrr bbbbrbbbrrrrb bbbbrbbrbrbbb bbbbrbbrrbbbr bbbbrbbrrbbrr bbb...
result:
ok 101 tokens
Test #14:
score: 0
Accepted
time: 4ms
memory: 3952kb
input:
14
output:
56 bbbbbbbrbbbbbb bbbbbbrbbbbbbb bbbbbbrbbbbbbr bbbbbbrbbbbbrr bbbbbbrbbbbrrb bbbbbbrbbbrrbb bbbbbbrbbrrbbb bbbbbbrbrrbbbb bbbbbbrrrbbbbb bbbbbrbbbbbbbr bbbbbrbbbbbbrb bbbbbrbbbbbbrr bbbbbrbbbbbrbr bbbbbrbbbbbrrb bbbbbrbbbbbrrr bbbbbrbbbbrbrb bbbbbrbbbbrrbb bbbbbrbbbbrrbr bbbbbrbbbbrrrr bbbbbrbbbrbr...
result:
ok 101 tokens
Test #15:
score: 0
Accepted
time: 6ms
memory: 3788kb
input:
15
output:
64 bbbbbbbrbbbbbbb bbbbbbrbbbbbbbr bbbbbbrbbbbbbrr bbbbbbrbbbbbrrb bbbbbbrbbbbrrbb bbbbbbrbbbrrbbb bbbbbbrbbrrbbbb bbbbbbrbrrbbbbb bbbbbbrrrbbbbbb bbbbbrbbbbbbbrb bbbbbrbbbbbbrbr bbbbbrbbbbbbrrr bbbbbrbbbbbrbrb bbbbbrbbbbbrrbr bbbbbrbbbbbrrrr bbbbbrbbbbrbrbb bbbbbrbbbbrrbbr bbbbbrbbbbrrbrr bbbbbrbbb...
result:
ok 101 tokens
Test #16:
score: 0
Accepted
time: 16ms
memory: 4664kb
input:
16
output:
72 bbbbbbbbrbbbbbbb bbbbbbbrbbbbbbbb bbbbbbbrbbbbbbbr bbbbbbbrbbbbbbrr bbbbbbbrbbbbbrrb bbbbbbbrbbbbrrbb bbbbbbbrbbbrrbbb bbbbbbbrbbrrbbbb bbbbbbbrbrrbbbbb bbbbbbbrrrbbbbbb bbbbbbrbbbbbbbbr bbbbbbrbbbbbbbrb bbbbbbrbbbbbbbrr bbbbbbrbbbbbbrbr bbbbbbrbbbbbbrrb bbbbbbrbbbbbbrrr bbbbbbrbbbbbrbrb bbbbbbrb...
result:
ok 101 tokens
Test #17:
score: 0
Accepted
time: 25ms
memory: 4668kb
input:
17
output:
81 bbbbbbbbrbbbbbbbb bbbbbbbrbbbbbbbbr bbbbbbbrbbbbbbbrr bbbbbbbrbbbbbbrrb bbbbbbbrbbbbbrrbb bbbbbbbrbbbbrrbbb bbbbbbbrbbbrrbbbb bbbbbbbrbbrrbbbbb bbbbbbbrbrrbbbbbb bbbbbbbrrrbbbbbbb bbbbbbrbbbbbbbbrb bbbbbbrbbbbbbbrbr bbbbbbrbbbbbbbrrr bbbbbbrbbbbbbrbrb bbbbbbrbbbbbbrrbr bbbbbbrbbbbbbrrrr bbbbbbrbb...
result:
ok 101 tokens
Test #18:
score: 0
Accepted
time: 57ms
memory: 10488kb
input:
18
output:
90 bbbbbbbbbrbbbbbbbb bbbbbbbbrbbbbbbbbb bbbbbbbbrbbbbbbbbr bbbbbbbbrbbbbbbbrr bbbbbbbbrbbbbbbrrb bbbbbbbbrbbbbbrrbb bbbbbbbbrbbbbrrbbb bbbbbbbbrbbbrrbbbb bbbbbbbbrbbrrbbbbb bbbbbbbbrbrrbbbbbb bbbbbbbbrrrbbbbbbb bbbbbbbrbbbbbbbbbr bbbbbbbrbbbbbbbbrb bbbbbbbrbbbbbbbbrr bbbbbbbrbbbbbbbrbr bbbbbbbrbbbb...
result:
ok 101 tokens
Test #19:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
19
output:
100 bbbbbbbbbrbbbbbbbbb bbbbbbbbrbbbbbbbbbr bbbbbbbbrbbbbbbbbrr bbbbbbbbrbbbbbbbrrb bbbbbbbbrbbbbbbrrbb bbbbbbbbrbbbbbrrbbb bbbbbbbbrbbbbrrbbbb bbbbbbbbrbbbrrbbbbb bbbbbbbbrbbrrbbbbbb bbbbbbbbrbrrbbbbbbb bbbbbbbbrrrbbbbbbbb bbbbbbbrbbbbbbbbbrb bbbbbbbrbbbbbbbbrbr bbbbbbbrbbbbbbbbrrr bbbbbbbrbbbbbbbr...
result:
ok 101 tokens
Test #20:
score: 0
Accepted
time: 2ms
memory: 3892kb
input:
20
output:
110 bbbbbbbbbbrbbbbbbbbb bbbbbbbbbrbbbbbbbbbb bbbbbbbbbrbbbbbbbbbr bbbbbbbbbrbbbbbbbbrr bbbbbbbbbrbbbbbbbrrb bbbbbbbbbrbbbbbbrrbb bbbbbbbbbrbbbbbrrbbb bbbbbbbbbrbbbbrrbbbb bbbbbbbbbrbbbrrbbbbb bbbbbbbbbrbbrrbbbbbb bbbbbbbbbrbrrbbbbbbb bbbbbbbbbrrrbbbbbbbb bbbbbbbbrbbbbbbbbbbr bbbbbbbbrbbbbbbbbbrb bb...
result:
ok 101 tokens
Test #21:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
50
output:
650 bbbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbr bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbrr bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbrrb bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbb...
result:
ok 101 tokens
Test #22:
score: -100
Wrong Answer
time: 0ms
memory: 3900kb
input:
51
output:
676 bbbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbr bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbrr bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbrrb bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbb...
result:
wrong answer 3rd words differ - expected: 'bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbr', found: 'bbbbbbbbbbbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbb'