QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#711355 | #7951. Magic Cards | kizen# | WA | 35ms | 14936kb | C++20 | 1.3kb | 2024-11-05 09:49:48 | 2024-11-05 09:49:48 |
Judging History
answer
#include <bits/stdc++.h>
#ifndef LOCAL
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#endif
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define pb push_back
#define pi array<int, 2>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, k, m, f;
cin >> n >> k >> m >> f;
vector<__int128> val(n + 1);
__int128 bt = 1;
for(int i = 0; i < k; ++i){
for(int j = 0; j < m; ++j){
int x; cin >> x; --x;
val[x] += bt;
}
bt += bt;
}
vector<int> id(n);
iota(all(id), 0);
sort(all(id), [&](int x, int y){return val[x] < val[y];});
while(f--){
string s; cin >> s;
__int128 sv = 0;
bt = 1;
for(int i = 0; i < k; ++i){
if(s[i] == 'Y') sv += bt;
bt += bt;
}
val[n] = sv;
int p = lower_bound(all(id), n, [&](int x, int y){return val[x] < val[y];}) - id.begin();
if(p == sz(id) || (p + 1 < sz(id) && val[id[p]] == val[n] && val[id[p + 1]] == val[n])){
cout << "0\n";
}
else{
cout << id[p] + 1 << '\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
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: 3848kb
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: 3616kb
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: 3616kb
input:
1 1 1 1 1 Y
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3556kb
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: 0
Accepted
time: 13ms
memory: 3560kb
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:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2 1 1 2 1 Y N
output:
1 2
result:
ok 2 lines
Test #8:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
2 2 1 2 1 2 YN NY
output:
1 2
result:
ok 2 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
3 2 1 3 1 2 YN NY NN
output:
1 2 3
result:
ok 3 lines
Test #10:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
3 3 1 3 1 2 3 YNN NYN NNY
output:
1 2 3
result:
ok 3 lines
Test #11:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
4 3 1 4 1 2 3 YNN NYN NNY NNN
output:
1 2 3 4
result:
ok 4 lines
Test #12:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
10 10 1 2 1 1 1 1 1 1 1 1 1 1 YYYYYYYYYY NNNNNNNNNN
output:
1 0
result:
ok 2 lines
Test #13:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
100 100 1 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
result:
ok 100 lines
Test #14:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
101 100 1 101 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
result:
ok 101 lines
Test #15:
score: -100
Wrong Answer
time: 35ms
memory: 14936kb
input:
500000 100 5000 50000 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:
1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 0 1 1 1 1 1 1 1 1 1 1 1...
result:
wrong answer 1st lines differ - expected: '2', found: '1'