QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#234859 | #6602. Journey to Un'Goro | inverno | WA | 2ms | 6660kb | C++14 | 2.4kb | 2023-11-02 00:05:25 | 2023-11-02 00:05:26 |
Judging History
answer
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
#define wr(a,b) cout << a << " " << b << endl
#define fo(i,a,b) for (int i = a;i <= b;++ i)
#define fd(i,a,b) for (int i = a;i >= b;-- i)
#define int long long
using namespace std;
//#define OWO
#ifdef OWO
#define debug(args...) LKJ("\033[1;32m[ " #args " ]\033[0m", args)
template<class I> void LKJ(I&&x){ cerr << x << '\n'; }
template<class I, class...T> void LKJ(I&&x, T&&...t){ cerr << x << ", ", LKJ(t...); }
template<class I> void OI(I a, I b){while(a < b) cerr << *a << " \n"[a+1 == b], ++a; }
#else
#define debug(...) 0
#define OI(...) 0
#endif
const int N = 1e5 + 10;
int T;
int A[N];
string st[N];
int n,cnt = 0, ans = 0;
void made1(int dt){
++cnt;
fo (i,0,dt-1){
fo (j,1,A[i]) cout << 'b';
cout << 'r';
}
fo (j,1,A[dt]) cout << 'b';
cout << '\n';
OI(A,A+dt+1);
return;
}
void made2(int dt){
++cnt;
fo (i,0,dt-1){
fo (j,1,A[i]) st[cnt] +='b';
st[cnt] +='r';
}
fo (j,1,A[dt]) st[cnt] +='b';
return;
}
void dfs(int w, int dt, int res) {
if (cnt == 100) return;
if (w == dt){
A[w] = res;
int ANS = 0;
fo (i,0,dt)
for (int j = i + 1;j <= dt;j += 2)
ANS += (A[i]+1) * (A[j]+1);
if (ANS==ans){
made2(dt);
}
return;
}
fd (i,res,0) {
A[w]=i;
dfs(w+1,dt,res-i);
}
}
void solve()
{
cin >> n;
// wr("----","----------------");
int a = (n+1)/2, b = (n+2)/2;
cnt = 0;
cout << (ans=a * b) << endl;
if (n >= 200) {
A[0]=n/2;
A[1]=n-1-A[0];
made1(1);
if (A[0] != A[1]) {
A[0]--;
A[1]++;
made1(1);
fo (i,0,48) {
A[1]--;
A[2]=i;
made1(2);
A[0]--;
A[1]++;
made1(2);
}
}
else {
fo (i,0,98) {
A[0] = n-2-i-A[1];
A[2] = i;
made1(2);
}
}
return;
}
// wr("n=",n);
// wr("ans=", (ans=a * b));
fo (k,1,n) {
fo (i,1,n) A[i] = 0;
//wr("k",k);
dfs(0,k,n-k);
}
sort(st+1,st+1+cnt);
fo(i,1,cnt) cout << st[i] << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
T = 1;
// cin >> T;
while(T--)
{
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 6504kb
input:
1
output:
1 r
result:
ok 2 tokens
Test #2:
score: 0
Accepted
time: 0ms
memory: 6576kb
input:
2
output:
2 br rb rr
result:
ok 4 tokens
Test #3:
score: 0
Accepted
time: 2ms
memory: 6536kb
input:
3
output:
4 brb rbr rrr
result:
ok 4 tokens
Test #4:
score: 0
Accepted
time: 2ms
memory: 6536kb
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: 6500kb
input:
5
output:
9 bbrbb brbbr brbrr brrrb rbbrb rbrbr rbrrr rrbrb rrrbr rrrrr
result:
ok 11 tokens
Test #6:
score: 0
Accepted
time: 2ms
memory: 6544kb
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: 0ms
memory: 6660kb
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: -100
Wrong Answer
time: 2ms
memory: 6544kb
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:
wrong answer 53rd words differ - expected: 'brrrbrrr', found: 'brrrrbrb'