QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#77789 | #5511. Minor Evil | XKError | WA | 567ms | 3740kb | C++ | 822b | 2023-02-15 16:43:46 | 2023-02-15 16:43:48 |
Judging History
answer
#include <bits/stdc++.h>
#define maxn 100005
using namespace std;
int n, k, m;
int a[maxn];
int b[maxn];
int s[maxn];
int t[maxn];
int res[maxn];
int main() {
int T;
scanf("%d", &T);
while (T--) {
int n, k;
scanf("%d%d", &n, &k);
for (int i = 1; i <= k; i++) {
scanf("%d%d", &a[i], &b[i]);
}
scanf("%d", &m);
for (int i = 1; i <= m; i++) {
int x;
scanf("%d", &x);
s[x] = 1;
}
bool flg = 1;
for (int i = k; i; i--) {
if (s[b[i]]) {
if (t[b[i]]) flg = 0;
else t[a[i]] = 1, s[b[i]] = 0, res[i] = 1;
}
}
if (flg) {
puts("TAK");
for (int i = 1; i <= k; i++) putchar(res[i] ? 'T' : 'N');
puts("");
}
else puts("NIE");
for (int i = 1; i <= n || i <= k; i++) a[i] = b[i] = s[i] = t[i] = res[i] = 0;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3348kb
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: 567ms
memory: 3740kb
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 NIE TAK N TAK T TAK NNN TAK NTN TAK TNN TAK NNN NIE TAK NTN TAK NNT TAK TNN TAK NNT TAK NNT TAK NNT NIE TAK NTT NIE TAK NNN TAK NNN TAK NNT TAK NNN TAK NNN TAK NTN TAK NTNN TAK TNTN NIE TAK NNNN NIE NIE NIE NIE TAK NNNT TAK TNTN TAK NNTN TAK NNNT TAK NNTN NIE TAK NNTN NIE TAK NNNN TAK NNN...
result:
wrong answer Contestant claims to have a found a solution on a NO input (test case 3)