QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#360402 | #6785. What Kind of Friends Are You? | Xiangmy# | AC ✓ | 72ms | 3656kb | C++20 | 1.7kb | 2024-03-21 18:55:07 | 2024-03-21 18:55:08 |
Judging History
answer
/*
* Author: Xiangmy
* Created: 2024-03-21 18:30
* Problem:
* Description:
*/
// #pragma GCC optimize(2)
// #pragma GCC optimize(3, "Ofast", "inline")
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << (x) << ' '
// #define x first
// #define y second
typedef long long LL;
const int INF = 0x3f3f3f3f;
typedef pair<int, int> PII;
void solve() {
int n, m; cin >> n >> m;
int k; cin >> k;
vector<string> s;
for (int i = 0; i < k; ++ i) {
string x; cin >> x;
s.push_back(x);
}
map<string, string> mp;
for (int v = 1; v <= m; ++ v) {
int c; cin >> c;
for (int i = 1; i <= c; ++ i) {
string ss; cin >> ss;
mp[ss] += '1';
}
for (int i = 0; i < k; ++ i) {
if (mp[s[i]].size() != v) mp[s[i]] += '0';
}
}
for (int i = 1; i <= n; ++ i) {
string t;
for (int j = 1; j <= m; ++ j) {
string c; cin >> c;
t += c;
}
int cnt = 0;
string man;
for (auto [x, y] : mp) {
if (y == t) {
cnt ++;
man = x;
}
}
if (cnt == 1) {
cout << man << "\n";
} else cout << "Let's go to the library!!\n";
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0); // 交互题不用
cout.tie(0);
// cout << fixed << setprecision(6);
// cout << setw(4) << setfill('0');
// init();
int T = 1;
cin >> T;
while (T -- ) {
// cin.ignore(numeric_limits<std::streamsize>::max(), '\n');
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3588kb
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: 72ms
memory: 3656kb
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