QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#583253 | #5511. Minor Evil | ticking_away# | WA | 0ms | 3648kb | C++17 | 1.1kb | 2024-09-22 19:14:46 | 2024-09-22 19:14:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ill = int64_t;
const int MXN = 1e6 + 7;
int n, m;
int inp[MXN][2];
bool res[MXN];
set<int> vit;
void solve() {
for(int i=m; i; --i) {
if(vit.count(inp[i][1])&&!vit.count(inp[i][0])) {
res[i] = 1;
vit.erase(inp[i][1]);
} else res[i] = 0;
}
if(vit.size()) cout << "NTE";
else {
cout << "TAK\n" << "NT"[res[1]];
for(int i=2; i<=m; ++i) {
cout << "NT"[res[i]];
}
}
}
void aft() {
memset(res+1, 0, n*sizeof(bool));
vit.clear();
cout << '\n';
}
void pre() {
cin >> n >> m;
for(int i=1; i<=m; ++i) {
cin >> inp[i][0] >> inp[i][1];
}
int k; cin >> k;
for(int i=1, v; i<=k; ++i) {
cin >> v; vit.insert(v);
}
}
int t_;
void init() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> t_;
}
int main() {
init();
for(int i=1; t_;) {
pre(); solve();
if(++i<=t_) aft();
else exit(0);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3648kb
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 NTNTNT NTE
result:
wrong answer No TAK/NIE in the contestant output (test case 2)