QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#481732 | #5511. Minor Evil | UESTC_DECAYALI# | WA | 412ms | 3756kb | C++17 | 856b | 2024-07-17 13:40:24 | 2024-07-17 13:40:25 |
Judging History
answer
#include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
int z; std::cin >> z; while(z--) {
int n, k; std::cin >> n >> k;
std::vector<bool> alive(n, true);
std::vector<std::pair<int, int>> edge(k);
for(auto &[f, t]: edge) {
std::cin >> f >> t;
f--, t--;
}
int s; std::cin >> s;
for(int i = 0, si; i < s; ++i) {
std::cin >> si;
alive[--si] = false;
}
std::string ans(k, 'N');
for(int i = k - 1; ~i; --i) {
auto [a, b] = edge[i];
if(alive[a] && !alive[b]) {
ans[i] = 'T';
alive[b] = true;
}
}
int i;
for(i = 0; i < n; ++i) if(!alive[i]) {
std::cout << "NIE";
break;
}
if(i == n) std::cout << "TAK\n" << ans << char(10);
}
return 0;
}
/*
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
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
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 NIE
result:
ok correct (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 412ms
memory: 3756kb
input:
1000 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 2 1 1 2 1 1 2 1 1 2 1 2 3 3 2 1 3 2 3 2 1 3 3 3 1 3 1 3 1 2 2 1 3 3 3 1 2 1 3 1 3 1 2 3 3 2 1 2 3 1 3 1 2 3 3 3 2 3 1 1 2 3 1 2 3 3 3 1 2 2 3 1 2 1 3 3 3 2 1 1 2 1 2 1 2 3 3 2 1 1 3 1 3 1 1 3 3 3 2 3 2 2 3 1 3 3 3 3 2 1 2 2 1 1 1 3 3 2 1 3 2...
output:
TAK NTNTNT NIENIETAK T NIENIETAK TNN NIENIETAK NTN TAK NNT TAK TNN TAK NNT TAK NNT TAK NNT NIENIENIENIENIENIENIENIENIETAK NTNN TAK TNTN NIENIENIENIENIENIENIETAK TNTN TAK NNTN TAK NNNT TAK NNTN NIETAK NNTN NIENIETAK NNNT NIETAK NNTN NIENIENIENIENIENIENIENIETAK NNT NIETAK NTN NIENIENIETAK TNT NIENIENI...
result:
wrong answer wrong length (test case 2)