QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325456 | #7951. Magic Cards | mateberishvili# | WA | 0ms | 3852kb | C++20 | 1.3kb | 2024-02-11 14:02:58 | 2024-02-11 14:02:58 |
Judging History
answer
#include<bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n, k, m, f;
cin >> n >> k >> m >> f;
vector<vector<ll>>nums(k);
unordered_map<ll,bool>is;
ll newNum = 0;
for(ll i = 0; i < k; i++){
for(ll j = 0; j < m; j++){
ll a;
cin >> a;
nums[i].pb(a);
if(!is[a])newNum++;
is[a] = true;
}
}
ll allNo = 1;
if(newNum == n - 1){
while(is[allNo]){
allNo++;
}
}else{
allNo = 0;
}
for(ll i = 0; i < f; i++){
string s;
cin >> s;
ll ly = -1, ny = 0, nny= 0;
vector<ll>fix(n + 1, 0);
ll q = 1;
for(ll j = 0; j < s.size(); j++){
if(s[j] == 'Y'){
unordered_map<ll,bool>was;
for(ll el : nums[j]){
if(!was[el])fix[el]++;
was[el] = true;
}
}else{
for(ll el : nums[j]){
if(fix[el] >= 0)ny++;
fix[el] = -2 * f;
}
}
}
if(ly == -1){
cout << allNo << endl;
}else{
ll ans = -1;
for(ll el : nums[ly]){
if(fix[el] == nny){
if(ans == -1)ans = el;
else {
cout << ans << " " << el;
ans = 0;
break;
}
}
}
cout << ans << endl;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3852kb
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:
0 0 0
result:
wrong answer 1st lines differ - expected: '11', found: '0'