QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#76351#5236. Wersja dla profesjonalistów [A]AFewSuns0 3ms3556kbC++142.0kb2023-02-09 11:46:182023-02-09 11:46:19

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-09 11:46:19]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3556kb
  • [2023-02-09 11:46:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
namespace my_std{
	#define ll long long
	#define bl bool
	ll my_pow(ll a,ll b,ll mod){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res=(res*a)%mod;
			a=(a*a)%mod;
			b>>=1;
		}
		return res;
	}
	ll qpow(ll a,ll b){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res*=a;
			a*=a;
			b>>=1;
		}
		return res;
	}
	#define db double
	#define pf printf
	#define pc putchar
	#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
	#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
	#define go(u) for(ll i=head[u];i;i=e[i].nxt)
	#define enter pc('\n')
	#define space pc(' ')
	#define fir first
	#define sec second
	#define MP make_pair
	#define il inline
	#define inf 8e18
	#define random(x) rand()*rand()%(x)
	#define inv(a,mod) my_pow((a),(mod-2),(mod))
	il ll read(){
		ll sum=0,f=1;
		char ch=0;
		while(!isdigit(ch)){
			if(ch=='-') f=-1;
			ch=getchar();
		}
		while(isdigit(ch)){
			sum=sum*10+(ch^48);
			ch=getchar();
		}
		return sum*f;
	}
	il void write(ll x){
		if(x<0){
			x=-x;
			pc('-');
		}
		if(x>9) write(x/10);
		pc(x%10+'0');
	}
	il void writeln(ll x){
		write(x);
		enter;
	}
	il void writesp(ll x){
		write(x);
		space;
	}
}
using namespace my_std;
ll pw[20];
string tmp;
string work(ll k,string s){
	string ans="";
	pfr(i,19,0){
		ll now=k/pw[i];
		if(now){
			ans+=(char)('0'+now);
			ans+='[';
			fr(j,1,i){
				ans+='9';
				ans+='[';
			}
			ans+=s;
			fr(j,1,i) ans+=']';
			ans+=']';
			k%=pw[i];
		}
	}
	return ans;
}
void solve(ll n){
	if(n==1){
		pf("AC");
		return;
	}
	if(n%2==1){
		ll k=n/2;
		write(2);
		pc('[');
		solve(k);
		pc(']');
		cout<<work(k,"AE");
		pc('A');
		tmp=work(k,"EC");
		tmp+='E';
		tmp+=work(k+1,"A");
		cout<<work(k,tmp);
		cout<<work(n,"C");
	}
	else{
		solve(n-1);
		cout<<work(n-1,"AE");
		pc('A');
		cout<<work(n,"C");
	}
}
int main(){
	pw[0]=1;
	fr(i,1,19) pw[i]=pw[i-1]*9;
	ll n=read();
	cout<<work(n,"E");
	solve(n);
} 

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3424kb

input:

1

output:

1[E]AC

result:

wrong answer incorrect path

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 2ms
memory: 3424kb

input:

320

output:

3[9[9[E]]]8[9[E]]5[E]2[2[2[2[2[2[2[AC]1[AE]A1[1[EC]E2[A]]3[C]3[AE]A4[C]]4[AE]A4[4[EC]E5[A]]1[9[C]]]1[9[AE]]A1[9[1[9[EC]]E1[9[A]]1[A]]]2[9[C]]1[C]]2[9[AE]]1[AE]A2[9[2[9[EC]]1[EC]E2[9[A]]2[A]]]1[2[9[EC]]1[EC]E2[9[A]]2[A]]4[9[C]]3[C]]4[9[AE]]3[AE]A4[9[4[9[EC]]3[EC]E4[9[A]]4[A]]]3[4[9[EC]]3[EC]E4[9[A]]4...

result:

wrong answer incorrect path

Subtask #3:

score: 0
Wrong Answer

Test #28:

score: 0
Wrong Answer
time: 2ms
memory: 3436kb

input:

1000000

output:

1[9[9[9[9[9[9[E]]]]]]]7[9[9[9[9[9[E]]]]]]8[9[9[9[9[E]]]]]3[9[9[9[E]]]]6[9[9[E]]]6[9[E]]1[E]2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AC1[AE]A2[C]]2[AE]A2[2[EC]E3[A]]5[C]5[AE]A6[C]]6[AE]A6[6[EC]E7[A]]1[9[C]]4[C]1[9[AE]]4[AE]A1[9[C]]5[C]]1[9[AE]]5[AE]A1[9[1[9[EC]]5[EC]E1[9[A]]6[A]]]5[1[9[EC]]5[EC]E1[9[A]]6[...

result:

wrong answer incorrect path

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 2ms
memory: 3428kb

input:

999999

output:

1[9[9[9[9[9[9[E]]]]]]]7[9[9[9[9[9[E]]]]]]8[9[9[9[9[E]]]]]3[9[9[9[E]]]]6[9[9[E]]]6[9[E]]2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AC1[AE]A2[C]]2[AE]A2[2[EC]E3[A]]5[C]5[AE]A6[C]]6[AE]A6[6[EC]E7[A]]1[9[C]]4[C]1[9[AE]]4[AE]A1[9[C]]5[C]]1[9[AE]]5[AE]A1[9[1[9[EC]]5[EC]E1[9[A]]6[A]]]5[1[9[EC]]5[EC]E1[9[A]]6[A]]3...

result:

wrong answer incorrect path

Subtask #5:

score: 0
Wrong Answer

Test #46:

score: 0
Wrong Answer
time: 3ms
memory: 3532kb

input:

10000000000

output:

2[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]7[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]7[9[9[9[9[9[9[9[9[E]]]]]]]]]2[9[9[9[9[9[9[9[E]]]]]]]]6[9[9[9[9[9[9[E]]]]]]]6[9[9[9[9[9[E]]]]]]7[9[9[9[9[E]]]]]8[9[9[9[E]]]]1[9[9[E]]]1[9[E]]1[E]2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AC]1[AE]A1[1[EC]E2[A]]3[C]]...

result:

wrong answer incorrect path

Subtask #6:

score: 0
Wrong Answer

Test #55:

score: 0
Wrong Answer
time: 2ms
memory: 3456kb

input:

9999999999

output:

2[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]7[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]7[9[9[9[9[9[9[9[9[E]]]]]]]]]2[9[9[9[9[9[9[9[E]]]]]]]]6[9[9[9[9[9[9[E]]]]]]]6[9[9[9[9[9[E]]]]]]7[9[9[9[9[E]]]]]8[9[9[9[E]]]]1[9[9[E]]]1[9[E]]2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AC]1[AE]A1[1[EC]E2[A]]3[C]]3[AE...

result:

wrong answer incorrect path

Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 0
Wrong Answer
time: 2ms
memory: 3456kb

input:

100000000000000

output:

4[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]3[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]3[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]5[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]6[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]4[9[9[9[9[9[9[9[9[E]]]]]]]]]2[9[9[9[9[9[9[9[E]]]]]]]]7[9[9[9[9[9[9[E]]]]]]]2[9[9[9[9[9[E]]]]]]7[9[9[9[9[E]...

result:

wrong answer incorrect path

Subtask #8:

score: 0
Wrong Answer

Test #84:

score: 0
Wrong Answer
time: 2ms
memory: 3556kb

input:

99999999999999

output:

4[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]3[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]3[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]5[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]6[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]4[9[9[9[9[9[9[9[9[E]]]]]]]]]2[9[9[9[9[9[9[9[E]]]]]]]]7[9[9[9[9[9[9[E]]]]]]]2[9[9[9[9[9[E]]]]]]7[9[9[9[9[E]...

result:

wrong answer incorrect path

Subtask #9:

score: 0
Wrong Answer

Test #103:

score: 0
Wrong Answer
time: 1ms
memory: 3528kb

input:

1000000000000000000

output:

6[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]]]]5[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]]]8[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]]5[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]8[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]3[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]...

result:

wrong answer the length of your output (326939) exceeds the constraint (150000)

Subtask #10:

score: 0
Wrong Answer

Test #128:

score: 0
Wrong Answer
time: 3ms
memory: 3448kb

input:

999999999999999999

output:

6[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]]]]5[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]]]8[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]]5[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]]8[9[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]]]]]3[9[9[9[9[9[9[9[9[9[9[9[9[9[E]]]]]]]]]]]...

result:

wrong answer the length of your output (325820) exceeds the constraint (150000)