QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#77789#5511. Minor EvilXKErrorWA 567ms3740kbC++822b2023-02-15 16:43:462023-02-15 16:43:48

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-15 16:43:48]
  • 评测
  • 测评结果:WA
  • 用时:567ms
  • 内存:3740kb
  • [2023-02-15 16:43:46]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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)