QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#201215 | #5161. Last Guess | Rd_rainydays# | WA | 0ms | 3580kb | C++14 | 910b | 2023-10-05 13:13:01 | 2023-10-05 13:13:03 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define N 505
using namespace std;
int n,m;
char s[N][N],t[N][N];
char ans[N];
int vis[N];
int mp[12334];
char vic;
char lis[N],tot=0;
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<n;i++){
scanf("%s%s",s[i]+1,t[i]+1);
}
vic='!';
for(int i=1;i<n;i++){
for(int r=1;r<=m;r++){
if(t[i][r]=='G')ans[r]=s[i][r],vis[r]=1;
if(t[i][r]=='Y')mp[s[i][r]]=1;
if(t[i][r]=='B')mp[s[i][r]]=-1;
}
}
for(int i=1;i<n;i++){
for(int r=1;r<=m;r++){
if(t[i][r]=='G')mp[s[i][r]]=0;
}
}
for(int i='a';i<='z';i++)if(mp[i]==1)lis[++tot]=(char)i;
for(int i='a';i<='z';i++)if(mp[i]!=-1){vic=i;break;}
// putchar(vic);putchar('\n');
for(int i=1;i<=m;i++){
if(vis[i])continue;
if(tot>0)ans[i]=lis[tot],tot--;
else ans[i]=vic;
}
puts(ans+1);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3580kb
input:
4 5 reply YYGBB refer BBBGG puppy YYGBB
output:
uaper
result:
FAIL Wrong answer: does not fit word 2