QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#574064#9320. Find the Easiest ProblemHorizonblackWA 7ms5784kbC++141.8kb2024-09-18 20:42:052024-09-18 20:42:06

Judging History

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

  • [2024-09-18 20:42:06]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:5784kb
  • [2024-09-18 20:42:05]
  • 提交

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[cnt][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();
			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: 100
Accepted
time: 0ms
memory: 5628kb

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
A

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 5784kb

input:

1000
44
WaiooyIXa O accepted
WaiooyIXa P accepted
ZYYsNWag P accepted
DPIawQg D rejected
IzPdjnM Z rejected
Ra D rejected
kwQyGxLo I rejected
DPIawQg L accepted
kwQyGxLo I accepted
mmWxDuADCB D rejected
PXwVAOgwiz P rejected
ZYYsNWag U accepted
IzPdjnM Z accepted
TgBNO P rejected
kwQyGxLo J accepted...

output:

Z
E
Z
O
B
I
G
H
S
K
J
I
H
R
Z
C
K
O
I
P
A
B
I
A
A
N
A
B
A
O
F
O
R
T
H
G
K
E
S
D
F
D
R
C
U
V
W
P
A
O
J
E
A
B
T
M
C
H
L
A
V
A
Z
N
E
O
Q
F
B
G
J
I
E
M
A
A
E
A
K
J
J
S
E
W
Z
K
F
I
S
P
M
G
G
G
H
W
I
P
T
D
O
A
F
N
C
S
Y
Z
S
G
J
F
Q
B
O
C
O
B
U
C
I
A
E
I
P
K
C
R
X
N
D
N
L
Q
L
I
X
I
H
U
J
Z
D
K
G
F
T
F
B
H
...

result:

wrong answer 4th lines differ - expected: 'I', found: 'O'