QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#197263 | #5511. Minor Evil | Alfeh | WA | 0ms | 3596kb | C++14 | 1.0kb | 2023-10-02 13:51:35 | 2023-10-02 13:51:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int sz = 1e5 + 5, mod = 1e9 + 7;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t = 1; cin >> t;
while(t--) {
int n, k; cin >> n >> k;
std::vector<pair<int,int>> v(k);
for(auto &[a, b]:v) cin >> a >> b;
int s; cin >> s;
std::vector<int> v1(n + 1), v2(n + 1), v3(n + 1);
for(int i = 0; i < s; i++) {
int a; cin >> a;
v1[a] = 1;
}
string ans(k, 'N');
for(int i = k - 1; i >= 0; i--) {
if(v2[v[i].second] || !v1[v[i].second]) continue;
if(v3[v[i].second]) continue;
ans[i] = 'T';
v2[v[i].second] = 1;
v3[v[i].first] = 1;
}
int pos = 1;
for(int i = 1; i <= n; i++)
pos&=(v2[i] >= v1[i]);
if(pos) {
cout << "TAK\n" << ans << "\n";
} else cout << "NTE\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
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)