QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#574139#9320. Find the Easiest ProblemHorizonblackWA 0ms3580kbC++141.8kb2024-09-18 20:54:092024-09-18 20:54:10

Judging History

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

  • [2024-09-18 20:54:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-09-18 20:54:09]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
#define maxn 100010
using namespace std;
template <typename T>inline void read(T &x){
	x=0;
	bool res=0;
	char c=getchar();
	while(!isdigit(c)){
		if(c=='-') res=1;
		c=getchar();
	}
	while(isdigit(c)){
		x=(x<<1)+(x<<3)+(c^'0');
		c=getchar();
	}
	if(res) x=(~x)+1;
	return;
}
template <typename T>inline void wr(T x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	if(x>9) wr(x/10);
	putchar((x%10)+'0');
	return; 
}
int t,n,len,num,sum[30],ans,cnt;
bool a[30][maxn],flag;
char ch,pas,te[maxn][15],pr,name[15];
int main(){
	read(t);
	while(t--){
		read(n);
		for(int i=1;i<=26;i++){
			for(int j=1;j<=cnt;j++){
				if(a[i][j]) a[i][j]=0;
			}
			sum[i]=0;
		}
		for(int j=1;j<=cnt;j++){
			for(int i=0;te[j][i];i++){
				te[j][i]=0;
			}
		}
		cnt=0;
		while(n--){
			ch=getchar();
			while(ch<'A'||ch>'Z'&&ch<'a'||ch>'z') ch=getchar();
			len=0;
			while(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z'){
				name[++len]=ch;
				ch=getchar();
			}
			flag=1;
			for(int i=1;i<=cnt;i++){
				if(!flag) break;
				if(strlen(te[i])!=len){
					continue;
				}
				for(int j=1;j<=len;j++){
					if(te[i][j-1]!=name[j]){
						break;
					}
					if(te[i][len-1]==name[len]){
						flag=0;
						num=i;
					}
				}
			}
			pr=getchar();
			ch=getchar();
			ch=getchar();
			cout<<ch<<endl;
			if(ch=='a'){
				if(flag){
					num=++cnt;
					for(int i=1;i<=len;i++){
						te[cnt][i-1]=name[i];
					}
				}
				if(a[pr-'A'+1][num]==0){
					a[pr-'A'+1][num]=1;
					sum[pr-'A'+1]++;
				}
			}
			for(int i=1;i<=7;i++) ch=getchar();
		}
		ans=0;
		for(int i=1;i<=26;i++){
			if(sum[i]>ans){
				ans=sum[i];
				pr='A'+i-1;
			}
		}
		putchar(pr);
		putchar('\n');
	}
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

output:

a
r
a
a
a
A
r
a
a
a
A

result:

wrong answer 1st lines differ - expected: 'A', found: 'a'