QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102692#6180. 滚动雪人游戏问题gcx12012100 ✓449ms3452kbC++14910b2023-05-03 16:10:572023-05-03 16:11:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 16:11:01]
  • 评测
  • 测评结果:100
  • 用时:449ms
  • 内存:3452kb
  • [2023-05-03 16:10:57]
  • 提交

answer

#include<bits/stdc++.h>
#include<cmath>
#define ll long long
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rof(i,a,b) for(int i=a;i>=b;i--)
#define N 100010

using namespace std;
int b[3];

ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}


int main()
{
    //freopen("snow.in","r",stdin);
    //freopen("snow.out","w",stdout);
    int n;
    while(cin>>n){
    	b[0]=b[1]=b[2]=0;
    	For(i,1,n){
    		char s;
    		cin>>s;
    		b[s-'A']++;
		}
		int x=(b[0]%2==b[1]%2?b[0]+b[1]-b[2]:0x3f3f3f3f),
			y=(b[0]%2==b[2]%2?b[0]+b[2]-b[1]:0x3f3f3f3f),
			z=(b[2]%2==b[1]%2?b[2]+b[1]-b[0]:0x3f3f3f3f);
		int mn=min(x,min(y,z));
		if((mn==x)+(mn==y)+(mn==z)>1) cout<<"N"<<endl;
		else cout<<(x==mn?"C":(y==mn?"B":"A"))<<endl;
	}
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 10
Accepted
time: 5ms
memory: 3404kb

input:

370
AAAABCCBBBACAABCAAAABBCCABACCBCCCCAAAAABBBCCACCBBBCBAABCABAABBCBAAAAABACBCAAAABBABBBBBBABCBBCCCACACABCCBBBABBBCACCBBAAABCACCACCABCAACBCCBBAABABCBCAAACABABCAAABCACCACCABCBCBCCCCCBCBCBACCCBACBCBBCBCCABCBABBCCBBAACCBBBCACBCBABBCABAABCCABCABBBABAABACACBBABBBCCACABCCCACABACCBBBBABABCBBBABABCCABAACAAB...

output:

B
C
C
B
C
A
A
B
A
A
A
A
A
C
A
B
A
A
A
C
A
B
A
A
B
N
C
B
B
C
B
B
A
C
A
B
A
C
B
N
A
B
B
C
B
C
C
B
A
B
A
B
A
A
B
A
C
C
A
A
C
B
A
C
C
B
A
B
C
C
B
B
B
A
A
B
B
A
C
A
B
C
N
B
A
B
B
B
B
C
C
B
C
B
B
B
C
B
C
C
C
N
B
A
A
A
A
A
A
A
C
C
C
C
A
C
A
B
B
B
A
A
B
A
C

result:

ok 125 lines

Test #2:

score: 10
Accepted
time: 2ms
memory: 3452kb

input:

909
CBABACBACABBCBCCCABCAAABCBCAACCCCBABACCABCBABCBABCABBBCCBBCCCABBCBABCBCBABABAAACACBBCCCBBCBCBCCBCCCACCBBABCBACCACCCBBBCBBACCACBCCCCAACCCACCABACACCCCBACCCCBAACBABAAAAACABBCABBCACCAABBBCCBCBAABCAAAAACBCACBBBBCCCCAAABBBBCCCBBAAACCACBCACCCBACCBCACCACAACCBCACCACBACAACBBAACBACAACAACABBCBAABACBACCBACCB...

output:

C
A
B
B
N
A
C
A
B
A

result:

ok 10 lines

Test #3:

score: 10
Accepted
time: 440ms
memory: 3388kb

input:

1272
BACAAACACABABACACAAABCCCCCABCBCBBCACBABAAAACCAABCBBCCABBCABCAABBBAABCBBBBCBABACACCCCBCCBCBBBCCBABBAABAABCAABBAAAABBCBAAAACBCBBBAAAABBBCBCBACCBBCCCCCBBCBAACBBBBCACCCABBCACCBABCBACBBBACAABCCBACCCBABCBAACCBCCCCBCCCCCBAACCCBBBBCCBBAAABBCBBBAABBAACBAAACAABBBBBACBBCBBBACCBCCAACCACCBAACCBBBACBBBAACBCB...

output:

C
C
C
C
A
B
B
B
B
B
A
B
B
A
A
A
B
A
B
A
B
A
C
B
A
B
C
A
C
B
C
C
C
A
C
C
A
A
B
A
A
A
A
A
A
C
C
C
C
B
C
C
B
A
A
A
N
C
A
A
A
A
B
A
C
C
B
B
A
A
C
B
B
A
A
C
B
A
B
C
B
A
C
A
A
A
A
A
B
B
A
C
A
A
C
B
A
C
B
B
B
A
B
A
A
C
C
C
B
B
B
B
C
B
C
B
C
B
A
C
B
B
B
C
C
C
A
C
B
A
A
B
C
A
B
B
A
C
A
A
A
A
B
C
B
A
C
C
A
C
...

result:

ok 2750 lines

Test #4:

score: 10
Accepted
time: 420ms
memory: 3248kb

input:

9694
ACABACCAAABAABACBBACACBCBBCCACBACAAACCBCBCCCCBAACACCACCABBCAABCCBCCBBCABBCBAAACABABBAAAABBCBABCCBBBABACCACABACCACCABBAABACAAABABCCAABBBCAAABCBCAACABBCCCABAAAAABBCCCAAABAABBCACABABCCBAACCBCABABBABAABBBABBACCBAAABCABAABCCBAAAACABBCAABCBBAABABCBBCCBCBBBBCCBCCAABBCAAAACABAABBBACACACBAACABAACACACCBB...

output:

A
C
C
B
A
C
A
B
B
B
A
A
B
B
B
B
C
A
B
B
A
B
C
B
C
B
C
C
B
C
A
C
A
B
C
C
C
C
A
A
A
A
A
C
A
B
A
B
B
B
B
A
A
A
A
C
B
B
B
A
B
B
A
B
C
C
C
A
B
A
A
B
A
A
A
C
B
B
B
B
A
B
B
A
C
B
C
C
B
B
C
B
C
B
A
A
A
C
A
A
B
B
C
B
B
B
B
B
A
B
C
B
A
C
C
B
B
C
A
A
B
A
A
B
A
C
C
A
B
A
C
A
B
A
A
A
C
C
A
A
C
C
C
C
A
C
A
A
C
A
...

result:

ok 2302 lines

Test #5:

score: 10
Accepted
time: 163ms
memory: 3252kb

input:

5385
ABCAABBBACAAACCCBCACCBBACAACCBBBBCCABCCBACBBCCACAAAACBACABCCBAACCBCCABCBBAABAAACBAABABBCBCBCCCBBBBCABBCCBCACBAABABBBAACACCBCABCBCBBCCBABCCBBBCBCCBCBCBCBAAAACCAABBBCCBAACCACBAAACCBBAAABCABACBBABAACACCAACCACBAABBBAAABBCCAACBAACCBABABBACABCCCACCCACBBCACAABABCACAAAAACABACCCBBBBCCCBABACABAACCCCCACAA...

output:

A
C
A
C
C
C
C
A
C
C
B
C
C
A
C
A
B
B
C
B
C
C
C
C
A
B
A
A
B
C
C
A
B
C
C
C
A
C
A
A
B
B
B
B
C
B
C
C
B
C
B
A
A
C
B
B
C
B
A
A
C
B
C
A
C
B
C
C
B
B
A
A
B
A
C
C
C
A
A
A
A
C
C
A
C
A
C
C
C
A
C
A
C
A
C
A
C
B
B
C
B
B
B
A
B
C
A
A
C
B
C
C
B
C
A
A
C
C
A
A
A
A
A
A
C
A
C
B
B
C
A
B
C
A
C
B
C
C
C
B
A
B
C
B
A
A
B
B
C
A
...

result:

ok 967 lines

Test #6:

score: 10
Accepted
time: 168ms
memory: 3280kb

input:

7790
CABACACCCAAACBBABAAABCBCBCBCBACAACBCBBBCABACBACBBAAACBBCACABABBCBBBCCABBAAACBACABCCCCBBAACCCBABCBCBCAAAAACCBBBCABCBCCACBACCBABAABAABCBCBBBABBBCBABAACBCBACACBCABCBCBBACBBCCCCCACAAACABBCBACCABBCBACCABBBCCCACBCBACAAACABCAACBCABCBCCCACAAAACBBBACCAAABCBAABCACBCCABBAAACACCCBABABBBCABBACBBBBACBBBBBCAA...

output:

A
B
A
A
C
B
A
C
C
B
A
C
A
B
C
C
B
A
B
A
A
C
C
A
C
A
B
B
A
B
B
B
C
B
C
C
C
A
A
C
C
B
C
C
C
A
C
B
N
C
A
B
B
B
A
B
B
B
A
A
A
B
B
B
B
C
C
C
B
B
B
A
A
C
C
C
A
A
A
B
A
A
A
C
B
C
B
C
B
C
B
B
C
B
B
B
B
C
A
B
C
A
B
B
B
A
C
C
B
A
A
B
C
B
A
B
B
B
B
A
B
A
C
B
B
B
B
B
A
A
C
B
C
A
N
B
B
C
C
A
A
N
A
A
C
C
A
A
B
C
...

result:

ok 1130 lines

Test #7:

score: 10
Accepted
time: 276ms
memory: 3384kb

input:

8580
BACCABCCBABBBCCBBACACACBBBABBCABCAACBCBBBBABBAAAACCACABCCBABCBCCBACCCBCBCCABCCCCBCCBCACBBACCCACBCCBCCAACBBCBABCABCCABCBCCBBAAACCACABCCCABABAACBCBCAAAAACCCCBABBAABBBAACBCCCCABBBBCCABCCABCCCABABAABBCCAABBBBBAAACAAACCCAABBACABACABACCACBCBBBACACCCAACCBBBAACABCCBBACBCCACABCBACCCCABCCCBCAAABAABBAACCB...

output:

A
C
C
B
B
B
B
B
C
B
C
A
C
C
C
C
B
B
B
B
B
C
B
A
C
C
C
B
B
B
B
A
B
A
A
B
B
N
C
A
C
A
B
A
C
C
A
A
C
A
B
B
A
C
C
B
C
B
A
B
B
A
A
C
C
C
B
C
B
A
A
B
A
C
B
A
B
A
C
B
A
C
C
C
C
A
C
N
B
A
B
A
B
B
A
C
C
C
C
B
C
C
C
A
A
B
B
A
C
A
B
A
C
A
C
B
A
A
A
A
C
A
B
A
B
B
B
A
B
B
A
A
C
A
C
C
C
C
C
C
B
C
C
B
C
A
A
A
C
C
...

result:

ok 1537 lines

Test #8:

score: 10
Accepted
time: 261ms
memory: 3264kb

input:

5296
BCAABBBCABBCBCCBAAAABABBBACACACABBACACBACCCBBACCCCCCAAACCBCAABCBACBCCACABACCABBBBBCCACCBCBBCCCACAABACACAAACABCBCABCBCCABCCACACCCCBBACAACCBABBCBBBBABACABBBACBABCBBAAABAAACBACCBCCCBCCAACBACABCCCBAAACBAABAACBBCBACACCABCBCACACCCAACACACBCBCBBCCBBBBBCCBCCCAACABBAABAACBCACBACBCACBAACAAAAAACBABABBCBAAC...

output:

C
B
A
A
C
A
B
C
C
C
B
A
C
B
B
C
C
C
B
B
B
C
B
C
B
B
C
C
B
A
C
A
A
A
B
B
C
B
C
B
A
A
C
A
N
B
A
A
B
A
C
A
C
B
B
C
C
B
B
C
A
B
B
B
B
C
C
A
B
C
C
A
B
A
A
B
B
A
A
B
A
B
A
B
C
B
B
A
B
A
B
B
A
A
C
C
A
C
N
A
C
B
A
C
B
B
C
N
B
B
B
B
B
A
A
B
C
B
B
A
C
C
C
A
A
A
C
C
B
C
A
C
A
B
A
B
C
C
A
C
A
A
A
C
A
B
A
B
C
C
...

result:

ok 1565 lines

Test #9:

score: 10
Accepted
time: 316ms
memory: 3304kb

input:

5195
AACCCCACABACBAAAACBAABBACAAAABBBBCBAAAABCCCACAABCBCAAABBBABBCCABABCCABBCBACBBBCBCCBCBCABABCAABACBAAACBBBABCBBCBCBAABACCABBBCBBBBCBACCCCCBCAAACACAAACBAAAACCCAABCCCCACAABCCCAABABAABAAABCBCCAAAACBAABBBACBBACCCCCABBBAABACCCAACABBABBAACBBBBBBCABBBACCCACCBBBACCABAACCBABAACBBCCBCABCBABCBABBCCAABBAACCB...

output:

A
C
A
A
B
B
B
B
B
A
N
C
A
C
C
B
A
B
B
B
A
C
C
A
C
C
A
C
C
B
A
C
A
C
C
A
C
B
A
C
B
B
A
A
A
B
C
C
B
C
A
C
A
A
A
C
B
B
C
C
A
A
B
B
C
A
B
A
A
A
B
B
A
A
A
B
C
B
A
C
A
C
C
C
B
B
A
B
C
C
C
A
B
C
C
B
B
C
C
C
C
A
A
A
C
A
A
B
B
C
B
B
A
A
C
B
C
C
A
C
B
A
C
C
B
B
A
C
C
A
A
C
A
A
B
B
A
B
B
C
B
C
A
C
B
A
B
B
A
C
...

result:

ok 1895 lines

Test #10:

score: 10
Accepted
time: 449ms
memory: 3400kb

input:

8526
BACBCCAACBBABABACBBBCBCAACCBBBCBABBBCBAABCACACCBBBAACCAABACBBCBAACCBABBAACBACBACCBCCAAABCAAAAAABBCABCBABBCCBBBBCCAACBCBABBBBBAACACBCBAAAABBBABBBAABBBBCBABBABBBAACCAABAACAACBCBBCBCABACCCBBAABCABCCBCAACCCCABBCCBBACBABABCCACAABCACBABACBCBCACBBAABCBAABBCABBCBABACCACCBBBACBCBCACAABBBACACBBBABCABAACB...

output:

A
B
B
B
A
C
B
B
C
C
C
C
A
C
A
C
B
C
C
B
C
C
A
B
B
B
A
C
C
B
A
B
B
A
C
C
B
N
C
C
B
C
C
B
B
A
C
B
C
C
A
B
B
A
B
B
A
B
A
A
B
A
A
B
C
C
A
A
C
C
B
C
C
C
B
C
B
B
B
C
C
B
B
C
A
B
A
A
A
B
B
A
C
C
B
C
C
B
A
A
C
C
C
B
C
N
C
B
B
B
C
B
C
C
B
B
B
C
B
B
C
C
B
C
C
A
C
A
B
B
B
C
C
A
B
A
A
C
A
A
C
A
B
C
C
C
B
A
A
A
...

result:

ok 2796 lines