QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#85596 | #5236. Wersja dla profesjonalistów [A] | anhduc2701 | 0 | 2ms | 3556kb | C++23 | 1.8kb | 2023-03-07 21:59:42 | 2023-03-07 21:59:44 |
Judging History
answer
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define eb emplace_back
#define PI 3.14159265359
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define BIT(x,i) (1&((x)>>(i)))
#define MASK(x) (1LL<<(x))
#define task "tnc"
typedef long long ll;
const ll INF=1e18;
const int maxn=1e6+5;
const int mod=1e9+7;
const int mo=998244353;
using pi=pair<ll,ll>;
using vi=vector<ll>;
using pii=pair<pair<ll,ll>,ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string mul(int x,string s){
vector<int>q;
while(x>0){
q.pb(x%9);
x/=9;
}
string ans;
for(int i=0;i<q.size();i++){
if(q[i]!=0){
ans+=char('0'+q[i]);
ans+="["+s+"]";
}
if(i!=len(q)-1){
ans+="[9";
}
}
for(int i=1;i<q.size();i++){
ans+="]";
}
return ans;
}
vector<string>kq;
void recur(int n){
if(n==1){
kq.pb("A");
}
else if(n==2){
kq.pb("AEACA");
}
else if(n==3){
kq.pb("AEAEACCAEACA");
}
else if(n%2==1){
int k=n/2;
string s1=mul(k+1,"A");
string s2=mul(k,"EC")+"E";
kq.pb(mul(k,s1+s2)+"A");
kq.pb(mul(k,"EA"));
kq.pb("2[");
kq.pb(mul(k,"C"));
recur(k);
kq.pb("]");
}
else{
kq.pb("A");
kq.pb(mul(n-1,"EA"));
kq.pb(mul(n-1,"C"));
recur(n-1);
}
}
signed main()
{
cin.tie(0),cout.tie(0)->sync_with_stdio(0);
//freopen(task".inp" , "r" , stdin);
//freopen(task".out" , "w" , stdout);
int n;
cin>>n;
kq.pb(mul(n,"C"));
recur(n);
kq.pb(mul(n,"E"));
for(auto v:kq){
cout<<v;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 1
Accepted
time: 2ms
memory: 3508kb
input:
1
output:
1[C]A1[E]
result:
ok correct (length = 3)
Test #2:
score: 0
Accepted
time: 2ms
memory: 3504kb
input:
2
output:
2[C]AEACA2[E]
result:
ok correct (length = 13)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3408kb
input:
4
output:
4[C]A3[EA]3[C]AEAEACCAEACA4[E]
result:
ok correct (length = 30)
Test #4:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
5
output:
5[C]2[3[A]2[EC]E]A2[EA]2[2[C]AEACA]5[E]
result:
ok correct (length = 43)
Test #5:
score: 0
Accepted
time: 2ms
memory: 3500kb
input:
6
output:
6[C]A5[EA]5[C]2[3[A]2[EC]E]A2[EA]2[2[C]AEACA]6[E]
result:
ok correct (length = 53)
Test #6:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
7
output:
7[C]3[4[A]3[EC]E]A3[EA]2[3[C]AEAEACCAEACA]7[E]
result:
ok correct (length = 53)
Test #7:
score: -1
Wrong Answer
time: 0ms
memory: 3452kb
input:
10
output:
1[C][91[C]]A[91[EA]][91[C]]4[5[A]4[EC]E]A4[EA]2[4[C]A3[EA]3[C]AEAEACCAEACA]1[E][91[E]]
result:
wrong answer invalid output
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 2ms
memory: 3512kb
input:
320
output:
5[C][98[C][93[C]]]A4[EA][98[EA][93[EA]]]4[C][98[C][93[C]]]6[7[A][98[A][91[A]]]6[EC][98[EC][91[EC]]]E][98[7[A][98[A][91[A]]]6[EC][98[EC][91[EC]]]E][91[7[A][98[A][91[A]]]6[EC][98[EC][91[EC]]]E]]]A6[EA][98[EA][91[EA]]]2[6[C][98[C][91[C]]]7[8[A][98[A]]7[EC][98[EC]]E][98[8[A][98[A]]7[EC][98[EC]]E]]A7[EA]...
result:
wrong answer invalid output
Subtask #3:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 2ms
memory: 3460kb
input:
1000000
output:
1[C][96[C][96[C][93[C][98[C][97[C][91[C]]]]]]]A[96[EA][96[EA][93[EA][98[EA][97[EA][91[EA]]]]]]][96[C][96[C][93[C][98[C][97[C][91[C]]]]]]]4[5[A][97[A][97[A][91[A][94[A][98[A]]]]]]4[EC][97[EC][97[EC][91[EC][94[EC][98[EC]]]]]]E][97[5[A][97[A][97[A][91[A][94[A][98[A]]]]]]4[EC][97[EC][97[EC][91[EC][94[EC...
result:
wrong answer invalid output
Subtask #4:
score: 0
Wrong Answer
Test #37:
score: 0
Wrong Answer
time: 0ms
memory: 3480kb
input:
999999
output:
[96[C][96[C][93[C][98[C][97[C][91[C]]]]]]]4[5[A][97[A][97[A][91[A][94[A][98[A]]]]]]4[EC][97[EC][97[EC][91[EC][94[EC][98[EC]]]]]]E][97[5[A][97[A][97[A][91[A][94[A][98[A]]]]]]4[EC][97[EC][97[EC][91[EC][94[EC][98[EC]]]]]]E][97[5[A][97[A][97[A][91[A][94[A][98[A]]]]]]4[EC][97[EC][97[EC][91[EC][94[EC][98[...
result:
wrong answer invalid output
Subtask #5:
score: 0
Wrong Answer
Test #46:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
10000000000
output:
1[C][97[C][96[C][93[C][97[C][97[C][98[C][97[C][94[C][95[C]]]]]]]]]][98[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91[EC][98[EC][93[EC][94[EC][98[EC][96[EC][92[EC]]]]]]]]]]E][97[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91...
result:
wrong answer invalid output
Subtask #6:
score: 0
Wrong Answer
Test #55:
score: 0
Wrong Answer
time: 2ms
memory: 3476kb
input:
9999999999
output:
1[C][97[C][96[C][93[C][97[C][97[C][98[C][97[C][94[C][95[C]]]]]]]]]][98[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91[EC][98[EC][93[EC][94[EC][98[EC][96[EC][92[EC]]]]]]]]]]E][97[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91...
result:
wrong answer invalid output
Subtask #7:
score: 0
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 2ms
memory: 3556kb
input:
100000000000000
output:
1[C][97[C][96[C][93[C][97[C][97[C][98[C][97[C][94[C][95[C]]]]]]]]]][98[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91[EC][98[EC][93[EC][94[EC][98[EC][96[EC][92[EC]]]]]]]]]]E][97[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91...
result:
wrong answer invalid output
Subtask #8:
score: 0
Wrong Answer
Test #84:
score: 0
Wrong Answer
time: 2ms
memory: 3556kb
input:
99999999999999
output:
1[C][97[C][96[C][93[C][97[C][97[C][98[C][97[C][94[C][95[C]]]]]]]]]][98[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91[EC][98[EC][93[EC][94[EC][98[EC][96[EC][92[EC]]]]]]]]]]E][97[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91...
result:
wrong answer invalid output
Subtask #9:
score: 0
Wrong Answer
Test #103:
score: 0
Wrong Answer
time: 2ms
memory: 3556kb
input:
1000000000000000000
output:
1[C][97[C][96[C][93[C][97[C][97[C][98[C][97[C][94[C][95[C]]]]]]]]]][98[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91[EC][98[EC][93[EC][94[EC][98[EC][96[EC][92[EC]]]]]]]]]]E][97[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91...
result:
wrong answer invalid output
Subtask #10:
score: 0
Wrong Answer
Test #128:
score: 0
Wrong Answer
time: 1ms
memory: 3548kb
input:
999999999999999999
output:
1[C][97[C][96[C][93[C][97[C][97[C][98[C][97[C][94[C][95[C]]]]]]]]]][98[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91[EC][98[EC][93[EC][94[EC][98[EC][96[EC][92[EC]]]]]]]]]]E][97[1[A][98[A][97[A][91[A][98[A][93[A][94[A][98[A][96[A][92[A]]]]]]]]]][98[EC][97[EC][91...
result:
wrong answer invalid output