QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#404731 | #6785. What Kind of Friends Are You? | LZDY | RE | 1ms | 3504kb | C++14 | 1.8kb | 2024-05-04 15:53:42 | 2024-05-04 15:53:42 |
Judging History
answer
/*
Created by Fredlin on 24-5-4.
Which submitted on .
tag:
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <string>
#include <cstring>
#include <queue>
#include <iomanip>
#include <set>
#include <bitset>
#include <tuple>
#include <unordered_map>
using namespace std;
#define int long long
#define ff first
#define ss second
#define mp(x, y) make_pair(x,y)
#define mtp(x, y, z) make_tuple(x,y,z)
#define rep(x) for(int i=0;i^x;++i)
#define inf 0x3f3f3f3f3f3f3f3f
#define ls k<<1
#define rs k<<1|1
typedef long long ll;
typedef pair <ll, ll> pii;
typedef tuple <ll, ll, ll> tiii;
//inline int find(int x){ return fa[x]=x?x:fa[x]=find(fa[x]]);}
const int maxn = 250,maxm=30;
int c;
inline int _hash(vector<bool> s){
int sum=0;
s.resize(c);
rep(s.size()) sum=sum*5+s[i];
return sum;
}
inline void solve() {
int n,q,nu;
string s;
cin>>n>>q>>c;
vector<vector<bool>> ss(maxm,vector<bool>(maxn));
unordered_map<string,int>nm;
string nmm[maxn];
//unordered_map<int,string>mp;
rep(c){
cin>>nmm[i];
nm[nmm[i]]=i;
}
rep(q){
cin>>nu;
for(int j=0;j<nu;j++) {
cin>>s;
ss[nm[s]][i] = true;
}
}
unordered_map<int,vector<int>> mp;
rep(c){
mp[_hash(ss[i])].push_back(i);
}
bool b;
vector<bool>qry(q);
rep(n){
for(int j=0;j<q;j++) cin>>b,qry[j]=b;
if(mp[_hash(qry)].size()==1) cout<<nmm[mp[_hash(qry)][0]]<<"\n";
else cout<<"Let's go to the library!!\n";
}
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
signed testCasesCount = 1;
cin>>testCasesCount;
while (testCasesCount--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3504kb
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: -100
Runtime Error
input:
100 98 16 154 rliLiumEVQKkJNnMjAj qnhiLgzjsjRsu eiHrssJvVWBLaRFMQVo TwLVZsRNyEOysXY JtYpguJiCihuObMygLVt YiquXjVeDoe pSkLcJbceYhjx vrVgRvYziqmEpVJdB OYLIFEnoKsDXLtEpyRIF EKTKIOpwEswTWgvihdCa MCCudkhYJC wOkSGOgjZlWgf hTcqiMZqeBCjOmzAt dPWGKzHa iDWjhWBQsoQCInigoNIf qGXWZvcWVJvGUbZ oRLdhU NecdjCwFAikYe...