QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#376973#7764. 世界沉睡童话zhouhuanyi0 7ms12200kbC++14863b2024-04-04 19:44:382024-04-04 19:44:39

Judging History

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

  • [2024-04-04 19:44:39]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:12200kb
  • [2024-04-04 19:44:38]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#define N 200000
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int n,rt,fa[N+1],p[N+1],a[N+1],tong[N+1],length;
vector<int>E[N+1];
void dfs(int x)
{
	tong[++length]=x;
	for (int i=0;i<E[x].size();++i) fa[E[x][i]]=x,dfs(E[x][i]);
	return;
}
int main()
{
	int d,x;
	bool op=1;
	n=read(),rt=read();
	for (int i=1;i<=n;++i) a[i]=read();
	for (int i=1;i<=n;++i)
	{
		d=read();
		while (d--) x=read(),E[i].push_back(x);
	}
	dfs(1);
	for (int i=length;i>=2;--i)
	{
		if (p[tong[i]]!=a[tong[i]]) swap(a[tong[i]],a[fa[tong[i]]]);
		op&=(p[tong[i]]==a[tong[i]]);
	}
	if (op)	puts("YES");
	else puts("NO");
	puts("no comment");
	puts("no comment");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 10480kb

input:

20 10
20 6 18 12 8 14 15 5 1 17 11 10 19 13 7 16 2 9 3 4
3 13 16 20
1 4
1 17
0
1 19
0
0
0
3 5 8 11
3 1 3 18
0
0
2 15 12
3 6 9 2
1 14
0
0
0
1 7
0
19 6 17 12 3 14 13 5 8 9 11 7 10 1 20 16 2 18 15 4

output:

NO
no comment
no comment

result:

wrong answer Your answer is completely wrong.

Subtask #2:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 7ms
memory: 12200kb

input:

80000 1
77649 27240 19178 10270 1981 6216 42189 63630 66779 68852 46110 27187 4598 75779 69930 43632 68065 13395 33234 17719 76420 65825 3003 67410 18637 3380 32923 66692 9430 1915 118 62287 69323 9735 72936 30221 46487 33367 59048 61582 55572 10657 61645 68649 23643 39197 38086 66512 58864 51881 69...

output:

NO
no comment
no comment

result:

wrong answer Your answer is completely wrong.

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #3:

0%

Subtask #6:

score: 0
Skipped

Dependency #4:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%

Subtask #8:

score: 0
Skipped

Dependency #7:

0%

Subtask #9:

score: 0
Skipped

Dependency #8:

0%

Subtask #10:

score: 0
Skipped

Dependency #9:

0%