QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#201215#5161. Last GuessRd_rainydays#WA 0ms3580kbC++14910b2023-10-05 13:13:012023-10-05 13:13:03

Judging History

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

  • [2023-10-05 13:13:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2023-10-05 13:13:01]
  • 提交

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