QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#573971 | #9320. Find the Easiest Problem | Horizonblack | WA | 4ms | 3768kb | C++14 | 1.8kb | 2024-09-18 20:27:36 | 2024-09-18 20:27:37 |
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();
len=0;
while(ch>='a'&&ch<='z'||ch>='A'&&ch<=getchar()){
name[++len]=ch;
ch=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: 3672kb
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: 4ms
memory: 3768kb
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:
P G R D T f m O C D R B T F E L N F Q R C W S B M V W Z F W L B W W P T G f f U f D H T I D T T F K Z D Z f I S k P m R V P R P f A H W S G k I G T D W f I I W X S E W B V J U T Z D Z f T V M U f V W P P R N f f E m k O W H I k G Z O L C R Z N D D G F P D L k T T R N P D m A C U W G Z I k m K Z Z H ...
result:
wrong answer 1st lines differ - expected: 'Z', found: 'P'