QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#270831 | #5161. Last Guess | ucup-team173# | WA | 1ms | 3648kb | C++20 | 1.7kb | 2023-12-01 16:00:12 | 2023-12-01 16:00:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define mpr make_pair
#define pb push_back
#define fi first
#define se second
const int maxn=555;
int g,l;
string wd[maxn],fdb[maxn];
int lim[maxn],ty[maxn];//0:>=,1=
int ban[26][maxn];
char sure[maxn];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>g>>l;
g--;
for(int i=1;i<=g;i++){
cin>>wd[i]>>fdb[i];
vector<int>cnt(26),bk(26);
for(int j=0;j<l;j++){
if(fdb[i][j]=='G'){
sure[j]=wd[i][j];
cnt[wd[i][j]-'a']++;
}
}
for(int j=0;j<l;j++){
ban[wd[i][j]-'a'][j]=1;
if(fdb[i][j]=='Y'){
cnt[wd[i][j]-'a']++;
}
if(fdb[i][j]=='B'){
ty[wd[i][j]-'a']=1;
lim[wd[i][j]-'a']=cnt[wd[i][j]-'a'];
bk[wd[i][j]-'a']=1;
}
}
for(int j=0;j<26;j++){
if(bk[j]==0){
if(ty[j]==0){
lim[j]=max(lim[j],cnt[j]);
}
}
}
}
for(int i=0;i<l;i++){
if(sure[i])
lim[sure[i]-'a']--;
}
for(int i=0;i<26;i++){
for(int j=0;j<l;j++){
if(ban[i][j]==0&&lim[i]&&sure[j]==0){
sure[j]=i+'a';
lim[i]--;
}
}
}
assert(*max_element(lim,lim+26)==0);
for(int i=0;i<26;i++){
for(int j=0;j<l;j++){
if(sure[j]==0&&ban[i][j]==0&&ty[i]==0){
sure[j]=i+'a';
}
}
}
cout<<sure<<"\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3524kb
input:
4 5 reply YYGBB refer BBBGG puppy YYGBB
output:
upper
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
2 12 aabbccddeeff GGGYGBYYYBBB
output:
aabdcbeadaaa
result:
ok
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3648kb
input:
25 500 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqoqqqqqqqqqqqqqqqqqqqqqqoqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjq...
output:
abcdefghijklmnoooprstuvwxyzaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
result:
FAIL Condition failed: "answer.size() == n"