QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#296156 | #7951. Magic Cards | defyers# | WA | 15ms | 5328kb | C++17 | 1.1kb | 2024-01-02 11:46:05 | 2024-01-02 11:46:05 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using ll = long long;
using pii = pair<int, int>;
void solve(int TC) {
int n, k, m, f;
cin >> n >> k >> m >> f;
vector<vector<int>> a(n + 1);
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= m; j++) {
int x;
cin >> x;
a[x].push_back(i);
}
}
map<string, vector<int>> M;
for (int i = 1; i <= n; i++) {
int pnt = 0;
string s = "";
for (int j = 1; j <= k; j++) {
if (pnt < a[i].size()) {
if (j == a[i][pnt]) {
s += "Y";
++pnt;
}
else s += "N";
}
else {
s += "N";
}
}
M[s].push_back(i);
}
for (int i = 1; i <= f; i++) {
string s;
cin >> s;
if (M.count(s)) {
auto &v = M[s];
if (v.size() == 1) {
cout << v[0] << "\n";
}
else {
cout << "0\n";
}
}
else {
cout << "0\n";
}
}
}
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(10);
int t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) {
solve(i);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
input:
12 4 6 3 1 9 7 11 3 5 2 10 3 6 7 11 4 5 6 7 6 12 8 11 10 9 12 9 YYNY NNNY YNNN
output:
11 8 1
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
13 4 6 4 1 9 7 11 3 5 2 10 3 6 7 11 4 5 6 7 6 12 8 11 10 9 12 9 YYNY NNNY YNNN NNNN
output:
11 8 1 13
result:
ok 4 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
14 4 6 4 1 9 7 11 3 5 2 10 3 6 7 11 4 5 6 7 6 12 8 11 10 9 12 9 YYNY NNNY YNNN NNNN
output:
11 8 1 0
result:
ok 4 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1 1 1 1 1 Y
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY...
output:
1
result:
ok single line: '1'
Test #6:
score: -100
Wrong Answer
time: 15ms
memory: 5328kb
input:
1 100 5000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'