QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#153762#5511. Minor EvilGotoHiotoriWA 0ms7612kbC++14552b2023-08-30 21:48:052023-08-30 21:48:05

Judging History

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

  • [2023-08-30 21:48:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:7612kb
  • [2023-08-30 21:48:05]
  • 提交

answer

#include<stdio.h>
int a[1000001],b[1000001],death[1000001],vis[1000001];
void work(){
	int n,m,s;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i)scanf("%d%d",a+i,b+i);
	scanf("%d",&s);
	for(int i=1;i<=n;++i)death[i]=0;
	for(int i=1,x;i<=s;++i)scanf("%d",&x),death[x]=1;
	for(int i=m;i>=1;--i)
		if(!death[a[i]]&&death[b[i]])
			--s,death[b[i]]=0,vis[i]=1;
	if(s)puts("NIE");
	else{
		puts("TAK");
		for(int i=1;i<=n;++i)
			putchar(vis[i]?'T':'N');
		puts("");
	}
}
int main(){
	int t;
	for(scanf("%d",&t);t--;work());
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 7612kb

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
NTNTN
NIE

result:

wrong answer wrong length (test case 1)