QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404734#6785. What Kind of Friends Are You?LZDYAC ✓23ms3636kbC++141.8kb2024-05-04 15:58:572024-05-04 15:59:31

Judging History

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

  • [2024-05-04 15:59:31]
  • 评测
  • 测评结果:AC
  • 用时:23ms
  • 内存:3636kb
  • [2024-05-04 15:58:57]
  • 提交

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*3+s[i];
    return sum;
}

inline void solve() {
    int  n,q,nu;
    string s;
    cin>>n>>q>>c;
    vector<vector<bool>> ss(maxn,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;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

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: 23ms
memory: 3636kb

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