QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#376975 | #7764. 世界沉睡童话 | zhouhuanyi | 2 | 10ms | 13252kb | C++14 | 901b | 2024-04-04 19:47:55 | 2024-04-04 19:47:57 |
Judging History
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);
}
for (int i=1;i<=n;++i) p[i]=read();
dfs(1);
for (int i=length;i>=2;--i)
{
if (p[tong[i]]!=a[tong[i]]) swap(p[tong[i]],p[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;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0.5
Acceptable Answer
time: 0ms
memory: 10944kb
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:
YES no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 11248kb
input:
20 15 10 16 5 1 14 15 2 8 19 9 6 3 7 12 13 11 4 20 17 18 0 0 1 10 0 0 1 17 0 3 6 20 19 3 8 12 1 1 5 3 18 14 2 2 11 13 0 0 2 9 16 1 3 1 7 1 4 0 0 12 18 9 7 5 16 20 3 17 2 14 15 13 19 11 6 1 10 8 4
output:
YES no comment no comment
result:
wrong answer Your answer is completely wrong.
Subtask #2:
score: 0.5
Acceptable Answer
Test #4:
score: 0.5
Acceptable Answer
time: 0ms
memory: 12536kb
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:
YES no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #5:
score: 0.5
Acceptable Answer
time: 4ms
memory: 12344kb
input:
80000 1 40751 74046 38639 8349 10511 79922 55598 63363 5123 68628 47324 17756 21270 35623 48141 31851 51342 75440 32 64257 20805 21871 72745 39461 76181 72542 12937 23663 69050 49377 74431 74875 66326 28811 65655 37532 53189 6723 56502 67191 76122 35519 22721 36131 31071 4212 11534 64384 71045 33940...
output:
NO no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #6:
score: 0.5
Acceptable Answer
time: 4ms
memory: 11792kb
input:
80000 1 52 92 20 169 34 249 69 125 25 131 77 32 55 182 43 150 219 5 15 236 26 155 6 19 39 4 93 23 21 47 318 40 179 328 7 38 95 42 146 49 268 227 61 214 36 148 73 3 10 60 90 33 28 56 220 18 122 46 64 188 44 1 50 396 173 218 561 58 51 79 72 53 17 100 97 66 78 118 8 68 80 81 211 84 99 136 133 205 11 11...
output:
NO no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Subtask #3:
score: 0
Wrong Answer
Dependency #2:
10%
Acceptable Answer
Test #7:
score: 0.5
Acceptable Answer
time: 0ms
memory: 11448kb
input:
80000 3823 8672 63816 1855 36775 59031 46214 57526 45575 56480 24946 44377 71695 48249 27546 7294 50921 44846 15666 48938 25415 52920 13826 22835 21341 1142 24320 29132 52868 64771 21558 60343 15685 75914 11345 44134 68985 77283 78587 12672 69815 6415 5331 75886 12703 35068 3032 31409 31937 9552 185...
output:
YES no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #8:
score: 0
Wrong Answer
time: 9ms
memory: 11596kb
input:
80000 60188 5794 26969 68934 26583 48201 17389 14742 77469 44368 2137 74498 60703 9179 31494 20743 20484 30465 15763 2175 10298 54198 810 52901 22117 69570 14168 20437 66380 11645 68961 53532 24346 8175 66161 79610 68212 11083 30646 53788 257 6139 33662 24868 65419 14595 38655 32846 48437 5746 7958 ...
output:
YES no comment no comment
result:
wrong answer Your answer is completely wrong.
Subtask #4:
score: 0.5
Acceptable Answer
Dependency #2:
10%
Acceptable Answer
Test #10:
score: 0.5
Acceptable Answer
time: 3ms
memory: 13020kb
input:
80000 1 23182 57274 19130 76507 5924 29197 57478 51488 74017 47401 32091 39255 79861 41955 26974 60662 2225 70963 4735 74401 52909 69178 36760 4690 44532 40697 73039 16264 67322 64193 8773 62412 3428 53091 14416 64609 25648 38035 58938 30410 9510 44821 74764 18342 70921 74358 36541 4577 75727 28512 ...
output:
NO no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #11:
score: 0.5
Acceptable Answer
time: 9ms
memory: 13252kb
input:
80000 1 61602 27516 53669 51811 14948 76631 192 16777 38570 5946 6954 12227 19942 68561 44448 64006 37108 15992 41511 40400 74124 37704 11985 29943 7097 41084 19256 29568 37388 56685 22863 77327 58896 48299 22126 51515 68870 30219 42431 18685 19954 27935 44008 75233 1372 26374 13728 29643 15853 1632...
output:
YES no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #12:
score: 0.5
Acceptable Answer
time: 2ms
memory: 12588kb
input:
80000 1 51403 43298 36255 30628 71642 1172 72452 42485 56088 13897 14689 1329 30730 20044 69736 78928 36520 29140 66633 53336 9061 64982 16774 8311 18347 41865 66679 25376 15633 7047 9244 38840 29360 34593 35221 29546 66474 62134 53176 72767 36402 11944 46808 71900 13231 23302 71179 54895 74879 6071...
output:
NO no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Subtask #5:
score: 0
Skipped
Dependency #3:
0%
Subtask #6:
score: 1
Acceptable Answer
Dependency #4:
10%
Acceptable Answer
Test #16:
score: 1
Acceptable Answer
time: 3ms
memory: 12812kb
input:
80000 1 45041 77508 44646 72960 5142 7856 42400 63064 69667 73163 10296 12545 39981 69398 67627 236 46390 62996 76158 17457 18506 47511 27823 77659 37104 45001 69521 34070 72424 54545 76591 35628 43288 38845 54268 55979 5284 76915 15449 57969 44321 11625 55473 55582 41841 33638 75319 24373 61557 597...
output:
YES no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #17:
score: 1
Acceptable Answer
time: 3ms
memory: 12624kb
input:
80000 1 45041 77508 44646 72960 5142 7856 42400 63064 69667 73163 10296 12545 39981 69398 67627 236 46390 62996 76158 17457 18506 47511 27823 77659 37104 45001 69521 34070 72424 54545 76591 35628 43288 38845 54268 55979 5284 76915 15449 57969 44321 11625 55473 55582 41841 33638 75319 24373 61557 597...
output:
YES no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #18:
score: 1
Acceptable Answer
time: 10ms
memory: 12032kb
input:
80000 1 50161 3582 54202 25676 14704 5676 46522 59613 47669 13501 11025 17907 56671 19668 23762 26613 59905 15126 74812 37288 72679 62932 49918 36622 43959 76525 6718 29715 60443 37227 60763 11585 62647 70716 40844 31317 37 139 17766 39317 75303 21411 17517 24945 2331 70054 36956 2659 10993 24512 50...
output:
NO no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #19:
score: 1
Acceptable Answer
time: 6ms
memory: 11384kb
input:
80000 1 40361 64075 72013 70693 38637 71819 51194 24672 72459 71666 45544 21500 57596 72431 40137 58335 10024 7210 68527 6658 57518 12598 44535 47884 37200 58195 29602 62334 292 35570 34798 64419 15579 61790 70161 65026 33083 11649 8877 36290 46237 58592 67068 72744 9662 66225 8171 15391 3506 31803 ...
output:
YES no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
Test #20:
score: 1
Acceptable Answer
time: 10ms
memory: 12500kb
input:
80000 1 2121 32603 23979 35796 52078 3980 45368 46551 72191 32691 54069 69934 8586 23672 23687 39505 21577 6616 70106 12037 8863 24170 47953 56687 31077 41888 7677 74243 2487 13474 5038 44019 849 6008 69906 30329 657 78328 26731 64745 61876 12577 56855 66240 2227 26396 29703 52107 7057 6030 31457 40...
output:
NO no comment no comment
result:
points 0.10 Your answer to Question 1 is correct. 10%.
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%