QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#573959 | #9320. Find the Easiest Problem | Horizonblack | RE | 0ms | 5644kb | C++14 | 1.9kb | 2024-09-18 20:25:39 | 2024-09-18 20:25:40 |
Judging History
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=getchar();
ch=getchar();
ch=getchar();
ch=getchar();
len=0;
name[++len]=getchar();
while(name[len]>='a'&&name[len]<='z'||name[len]>='A'&&name[len]<=getchar()){
name[++len]=getchar();
}
flag=1;
for(int i=1;i<=cnt;i++){
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: 5644kb
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
Runtime Error
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...