QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#695061 | #1439. Football Match | Afterlife# | WA | 0ms | 3716kb | C++20 | 1.3kb | 2024-10-31 19:15:03 | 2024-10-31 19:15:04 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,p,q;
string s;
vector<int> A,B;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
cin>>s;
for(auto c:s){
if(c=='Y')++p;
else ++q;
}
int sum=0;
if(p%2==1){
if(p==1&&q==1){
cout<<"NO\n";
return 0;
}
for(int i=1;i<=p;++i){
A.push_back(1);
sum++;
}
if(q>0){
for(int i=1;i<=q-1;++i){
B.push_back(2);
sum+=2;
}
sum-=1;
B.push_back(sum);
}
}
else{
if(q<=1){
cout<<"NO\n";
return 0;
}
for(int i=1;i<=p;++i){
A.push_back(2);
sum+=2;
}
if(q&1){
B.push_back(4);
sum+=4;
--q;
}
for(int i=1;i<=q-1;++i){
B.push_back(1);
++sum;
}
sum-=2;
B.push_back(sum);
}
cout<<"YES\n";
for(auto c:s){
if(c=='Y'){
cout<<A.back()<<' ';
A.pop_back();
}
else{
cout<<B.back()<<' ';
B.pop_back();
}
}
cout<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
4 YNNY
output:
YES 2 3 1 2
result:
ok OK
Test #2:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
3 NNN
output:
YES 3 1 4
result:
ok OK
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
4 NNNN
output:
YES 1 1 1 1
result:
ok OK
Test #4:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
5 NNNNN
output:
YES 5 1 1 1 4
result:
ok OK
Test #5:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
3 YNN
output:
YES 1 2 2
result:
ok OK
Test #6:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
4 NNYN
output:
YES 4 2 1 2
result:
ok OK
Test #7:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
5 NNYNN
output:
YES 6 2 1 2 2
result:
ok OK
Test #8:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
3 YYN
output:
NO
result:
ok OK
Test #9:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
4 NNYY
output:
YES 3 1 2 2
result:
ok OK
Test #10:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
5 YNYNN
output:
YES 2 7 2 1 4
result:
ok OK
Test #11:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
3 YYY
output:
YES 1 1 1
result:
ok OK
Test #12:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
4 YYNY
output:
YES 1 1 2 1
result:
ok OK
Test #13:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
5 YYNNY
output:
YES 1 1 4 2 1
result:
ok OK
Test #14:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
4 YYYY
output:
NO
result:
ok OK
Test #15:
score: -100
Wrong Answer
time: 0ms
memory: 3668kb
input:
5 YNYYY
output:
NO
result:
wrong answer Wrong answer