QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#576020 | #6785. What Kind of Friends Are You? | RMaple | AC ✓ | 37ms | 4580kb | C++17 | 1.3kb | 2024-09-19 17:57:16 | 2024-09-19 17:57:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const string No="Let's go to the library!!";
typedef struct Fname
{
string name;
string question;
}Friend;
Friend box[15000];
void query(int n,int q)
{
string a;
char ch;
for(int i=0;i<q;i++)
{
cin>>ch;
a=a+ch;
}
int flag=0;
int ni,loc;
for(ni=0;ni<n;ni++)
{
if(box[ni].question==a)
{
flag++;
loc=ni;
}
}
if(flag!=1)
cout<<No<<endl;
else
cout<<box[loc].name<<endl;
}
void solve()
{
ios::sync_with_stdio(false);
int n,q;
cin>>n>>q;
int friend_num;
cin>>friend_num;
for(int fi=0;fi<friend_num;fi++)
{
cin>>box[fi].name;
box[fi].question="";
}//将人名存入结构体
string nm;
for(int qqi=0;qqi<q;qqi++)
{
int fnum_this_round;
cin>>fnum_this_round;
set<string>name_this_round;
for(int ffi=0;ffi<fnum_this_round;ffi++)
{
cin>>nm;
name_this_round.insert(nm);
}
for(int nni=0;nni<friend_num;nni++)
{
if(name_this_round.count(box[nni].name)!=0)
box[nni].question=box[nni].question+'1';
else
box[nni].question=box[nni].question+'0';
}
}
for(int qqqi=0;qqqi<n;qqqi++)
query(friend_num,q);
}
int main()
{
int t;
cin>>t;
for(int ti=0;ti<t;ti++)
solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4428kb
input:
2 3 4 5 Serval Raccoon Fennec Alpaca Moose 4 Serval Raccoon Alpaca Moose 1 Serval 1 Fennec 1 Serval 1 1 0 1 0 0 0 0 1 0 0 0 5 5 11 A B C D E F G H I J K 3 A B K 4 A B D E 5 A B K D E 10 A B K D E F G H I J 4 B D E K 0 0 1 1 1 1 0 1 0 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1
output:
Serval Let's go to the library!! Let's go to the library!! Let's go to the library!! Let's go to the library!! B Let's go to the library!! K
result:
ok 8 lines
Test #2:
score: 0
Accepted
time: 37ms
memory: 4580kb
input:
100 98 16 154 rliLiumEVQKkJNnMjAj qnhiLgzjsjRsu eiHrssJvVWBLaRFMQVo TwLVZsRNyEOysXY JtYpguJiCihuObMygLVt YiquXjVeDoe pSkLcJbceYhjx vrVgRvYziqmEpVJdB OYLIFEnoKsDXLtEpyRIF EKTKIOpwEswTWgvihdCa MCCudkhYJC wOkSGOgjZlWgf hTcqiMZqeBCjOmzAt dPWGKzHa iDWjhWBQsoQCInigoNIf qGXWZvcWVJvGUbZ oRLdhU NecdjCwFAikYe...
output:
Let's go to the library!! Let's go to the library!! Let's go to the library!! Let's go to the library!! Let's go to the library!! Let's go to the library!! Let's go to the library!! Let's go to the library!! Let's go to the library!! FJVBxEemjhzUqZxTjU Let's go to the library!! Let's go to the libra...
result:
ok 9542 lines