QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#749095 | #5511. Minor Evil | agh4 | WA | 1ms | 3504kb | C++23 | 1.2kb | 2024-11-14 22:38:07 | 2024-11-14 22:38:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int z;
cin >> z;
while (z--){
int n, k;
cin >> n >> k;
vector<pair<int, int>> S;
for(int i = 0; i<k; i++){
int a, b;
cin >> a >> b;
S.push_back({a, b});
}
int s;
cin >> s;
set<int> martwi;
for(int i=0;i<s;i++) {
int tmp;
cin>>tmp;
martwi.insert(tmp);
}
vector<char> ans;
reverse(S.begin(), S.end());
for(auto [a, b]:S) {
if(martwi.find(a) == martwi.end()) {
if(martwi.find(b) != martwi.end()) {
ans.push_back('T');
martwi.erase(b);
}
} else {
ans.push_back('N');
}
}
if(martwi.size() == 0) {
cout<<"TAK\n";
reverse(ans.begin(), ans.end());
for(auto x:ans) cout<<x;
cout<<'\n';
} else {
cout<<"NIE\n";
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3504kb
input:
2 5 6 1 2 2 1 2 5 2 3 2 4 4 2 3 1 2 3 3 2 1 2 2 3 2 2 3
output:
TAK TTT NIE
result:
wrong answer wrong length (test case 1)