QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587615#6785. What Kind of Friends Are You?piggy123#AC ✓18ms3832kbC++203.1kb2024-09-24 20:51:292024-09-24 20:51:31

Judging History

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

  • [2024-09-24 20:51:31]
  • 评测
  • 测评结果:AC
  • 用时:18ms
  • 内存:3832kb
  • [2024-09-24 20:51:29]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll pp[505];

int main(){
	cin.tie(0);cout.tie(0);
	ios::sync_with_stdio(false);
	ll t;
	cin >> t;
	while (t--){
		ll n,q,c;
		cin >> n >> q >> c;
		for (ll i=1;i<=c;i++)pp[i]=0;
		map<string,ll> mp;
		map<ll,string> to,cp;
		map<ll,ll> cc;
		
		for (ll i=1;i<=c;i++){
			string s;
			cin >> s;
			mp[s]=i,to[i]=s;
		}
		for (ll i=1;i<=q;i++){
			ll m;
			cin >> m;
			for (ll j=1;j<=m;j++){
				string v;
				cin >> v;
				ll id=mp[v];
				pp[id]|=(1ll<<(i-1));
			}
		}
		for (ll i=1;i<=c;i++)cc[pp[i]]++,cp[pp[i]]=to[i];
		for (ll i=1;i<=n;i++){
			ll v=0;
			for (ll j=0;j<q;j++){
				ll x=0;
				cin>> x;
				v|=(x<<j);
			}
			if (cc[v]!=1){
				cout<< "Let's go to the library!!\n";
			}else{
				cout<< cp[v]<<"\n";
			}
		}
	}
	return 0;
}

/*
                                                                
 ■■■■■     ■■      ■■■     ■■■   ■    ■     ■     ■■■■    ■■■■  
 ■   ■■    ■■     ■  ■■   ■  ■■  ■    ■    ■■     ■  ■■  ■■  ■  
 ■    ■    ■■    ■    ■  ■    ■   ■  ■    ■■■    ■■  ■■  ■   ■■ 
 ■    ■    ■■    ■    ■  ■    ■   ■  ■     ■■    ■   ■■      ■■ 
 ■    ■    ■■    ■       ■         ■■      ■■        ■■      ■  
 ■   ■■    ■■    ■  ■■■  ■  ■■■    ■■      ■■       ■■     ■■■  
 ■■■■■     ■■    ■    ■  ■    ■    ■■      ■■      ■■        ■■ 
 ■         ■■    ■    ■  ■    ■    ■■      ■■     ■■          ■ 
 ■         ■■    ■    ■  ■    ■    ■■      ■■     ■      ■   ■■ 
 ■         ■■    ■■  ■■  ■■  ■■    ■■      ■■    ■       ■■  ■■ 
 ■         ■■      ■■■■    ■■■■    ■■      ■■    ■■■■■■   ■■■■  
*/

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3832kb

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: 18ms
memory: 3668kb

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