Task: | Astralis session I |
Sender: | aalto2024b_002 |
Submission time: | 2024-09-11 17:14:41 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | WRONG ANSWER | 0.01 s | details |
#27 | WRONG ANSWER | 0.01 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.01 s | details |
#30 | WRONG ANSWER | 0.01 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.01 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.01 s | details |
#36 | WRONG ANSWER | 0.01 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.00 s | details |
#40 | WRONG ANSWER | 0.01 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.01 s | details |
#43 | TIME LIMIT EXCEEDED | -- | details |
#44 | TIME LIMIT EXCEEDED | -- | details |
#45 | TIME LIMIT EXCEEDED | -- | details |
#46 | WRONG ANSWER | 0.01 s | details |
#47 | WRONG ANSWER | 0.01 s | details |
#48 | TIME LIMIT EXCEEDED | -- | details |
#49 | WRONG ANSWER | 0.35 s | details |
#50 | WRONG ANSWER | 0.01 s | details |
#51 | WRONG ANSWER | 0.12 s | details |
#52 | RUNTIME ERROR | 0.39 s | details |
#53 | RUNTIME ERROR | 0.40 s | details |
#54 | RUNTIME ERROR | 0.39 s | details |
#55 | RUNTIME ERROR | 0.39 s | details |
#56 | RUNTIME ERROR | 0.40 s | details |
#57 | RUNTIME ERROR | 0.39 s | details |
#58 | RUNTIME ERROR | 0.39 s | details |
#59 | RUNTIME ERROR | 0.39 s | details |
#60 | RUNTIME ERROR | 0.39 s | details |
#61 | RUNTIME ERROR | 0.39 s | details |
Compiler report
input/code.cpp: In function 'int BFS(std::vector<std::vector<int> >&, std::vector<bool>&, int)': input/code.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 23 | for(int i=0; i<roads[x].size(); i++){ | ~^~~~~~~~~~~~~~~~ input/code.cpp: In function 'int main()': input/code.cpp:42:28: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare] 42 | for(unsigned int i=0; i<(n-1); i++){ | ~^~~~~~ input/code.cpp:54:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 54 | for(int i=0; i< edges.size(); i++){ | ~^~~~~~~~~~~~~~ input/code.cpp:81:23: warning: comparison of integer expressions of different signedn...
Code
#include <iostream> #include <vector> #include <queue> using namespace std; int BFS(vector<vector<int>>& roads, vector<bool>& visited, int ini){ queue<int> q; q.push(ini); int count = 0; while(not q.empty()) { int x = q.front(); visited[x]=true; count += 1; q.pop(); for(int i=0; i<roads[x].size(); i++){ if(roads[x][i]==true and not visited[i]){ q.push(i); } } } //cout<<count<<endl; return count; } int main(){ int n; cin >> n; vector<vector<int>> roads(n, vector<int>(n,false)); vector<pair<int,int>> edges(n-1); for(unsigned int i=0; i<(n-1); i++){ int a,b; cin >> a >> b; roads[a-1][b-1]=true; roads[b-1][a-1]=true; edges[i] = make_pair(a-1,b-1); } vector<bool> visited(n,false); bool sol=false; for(int i=0; i< edges.size(); i++){ //cout<<i<<endl; int x = edges[i].first; int y = edges[i].second; roads[x][y]=false; roads[y][x]=false; visited = vector<bool>(n,false); int a = BFS(roads, visited, x); if(a == n/2){ //cout<<"hola"<<endl; visited = vector<bool>(n,false); int b = BFS(roads, visited, x); if(b == n/2){ sol = true; break; } } roads[x][y]=true; roads[y][x]=true; } if(sol){ cout<<"YES"<<endl; for(int i=0; i< visited.size(); i++){ if(visited[i]==false){ cout <<'M'; } else cout << 'U'; } } else cout << "NO" << endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
2 1 2 |
correct output |
---|
Yes MU |
user output |
---|
YES UM |
Test 2
Verdict: WRONG ANSWER
input |
---|
6 1 3 2 3 2 6 4 6 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 3
Verdict: WRONG ANSWER
input |
---|
6 1 2 2 3 3 6 2 4 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 4
Verdict: WRONG ANSWER
input |
---|
6 1 6 1 4 2 4 2 3 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 5
Verdict: WRONG ANSWER
input |
---|
6 2 4 1 4 2 6 1 3 ... |
correct output |
---|
Yes MUMUMU |
user output |
---|
YES UMUMUM |
Test 6
Verdict: WRONG ANSWER
input |
---|
8 1 8 5 8 3 5 3 6 ... |
correct output |
---|
Yes MUMUMUUM |
user output |
---|
YES UMUMUMMU |
Test 7
Verdict: WRONG ANSWER
input |
---|
8 1 4 1 6 3 6 1 5 ... |
correct output |
---|
Yes MUUMMUMU |
user output |
---|
YES UMMUUMUM |
Test 8
Verdict: WRONG ANSWER
input |
---|
8 1 7 1 3 1 8 2 8 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 9
Verdict: WRONG ANSWER
input |
---|
8 2 3 3 8 7 8 5 8 ... |
correct output |
---|
Yes MMUMUMUU |
user output |
---|
YES UUMUMUMM |
Test 10
Verdict: WRONG ANSWER
input |
---|
10 4 8 4 7 1 7 3 4 ... |
correct output |
---|
Yes MUMMMUMUUU |
user output |
---|
YES UMUUUMUMMM |
Test 11
Verdict: WRONG ANSWER
input |
---|
10 3 4 4 5 4 8 4 10 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 12
Verdict: WRONG ANSWER
input |
---|
10 1 3 2 3 2 6 6 10 ... |
correct output |
---|
Yes MMMUUMUMUU |
user output |
---|
YES UUUMMUMUMM |
Test 13
Verdict: WRONG ANSWER
input |
---|
10 1 10 1 3 6 10 8 10 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 14
Verdict: WRONG ANSWER
input |
---|
10 1 6 1 4 2 4 2 9 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 15
Verdict: WRONG ANSWER
input |
---|
12 4 10 4 11 9 11 6 11 ... |
correct output |
---|
Yes UUUMUMMUMUMM |
user output |
---|
YES MMMUMUUMUMUU |
Test 16
Verdict: WRONG ANSWER
input |
---|
12 1 2 1 8 5 8 3 8 ... |
correct output |
---|
Yes MUMMMUUMUUUM |
user output |
---|
YES UMUUUMMUMMMU |
Test 17
Verdict: WRONG ANSWER
input |
---|
14 9 12 6 9 3 6 3 11 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 18
Verdict: WRONG ANSWER
input |
---|
14 13 14 7 13 3 7 7 10 ... |
correct output |
---|
Yes UMMMMUMUUMUUMU |
user output |
---|
YES MUUUUMUMMUMMUM |
Test 19
Verdict: WRONG ANSWER
input |
---|
14 1 3 3 8 3 7 8 9 ... |
correct output |
---|
Yes MUUUMMUUUMMMMU |
user output |
---|
YES UMMMUUMMMUUUUM |
Test 20
Verdict: WRONG ANSWER
input |
---|
16 4 12 1 4 12 16 11 12 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 21
Verdict: WRONG ANSWER
input |
---|
18 12 13 13 17 8 13 12 15 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 22
Verdict: WRONG ANSWER
input |
---|
100 24 28 28 65 28 58 54 65 ... |
correct output |
---|
Yes MMUUMUMMUMUMUUMUUMMUUUMMMUUUUM... |
user output |
---|
YES UUMMUMUUMUMUMMUMMUUMMMUUUMMMMU... Truncated |
Test 23
Verdict: WRONG ANSWER
input |
---|
100 57 98 24 57 24 34 25 34 ... |
correct output |
---|
Yes MUUMUMUUUMMUMMUMUMMMMMUUUMUUMM... |
user output |
---|
YES UMMUMUMMMUUMUUMUMUUUUUMMMUMMUU... Truncated |
Test 24
Verdict: WRONG ANSWER
input |
---|
100 6 41 6 20 6 18 6 88 ... |
correct output |
---|
Yes MMMMUMMMUMUUMMUUUMMMUUUUUMUUUU... |
user output |
---|
YES UUUUMUUUMUMMUUMMMUUUMMMMMUMMMM... Truncated |
Test 25
Verdict: WRONG ANSWER
input |
---|
100 24 100 92 100 62 100 88 100 ... |
correct output |
---|
Yes MUUMMUUMMUMUMUMUUUUUUMMMUMUMUM... |
user output |
---|
YES UMMUUMMUUMUMUMUMMMMMMUUUMUMUMU... Truncated |
Test 26
Verdict: WRONG ANSWER
input |
---|
100 65 83 68 83 65 87 21 65 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 27
Verdict: WRONG ANSWER
input |
---|
100 12 87 12 56 41 56 11 41 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 28
Verdict: WRONG ANSWER
input |
---|
100 13 29 13 38 13 34 10 13 ... |
correct output |
---|
Yes MMMMUUMUMMUUMMUUMMMUMMUUMMUUUU... |
user output |
---|
YES UUUUMMUMUUMMUUMMUUUMUUMMUUMMMM... Truncated |
Test 29
Verdict: WRONG ANSWER
input |
---|
100 77 94 52 77 53 77 53 56 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 30
Verdict: WRONG ANSWER
input |
---|
100 56 59 56 76 17 76 17 75 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 31
Verdict: WRONG ANSWER
input |
---|
100 19 70 70 86 27 86 27 31 ... |
correct output |
---|
Yes MMMMUMMUMMUUMMUMUUUMMMUMUMUUMU... |
user output |
---|
YES UUUUMUUMUUMMUUMUMMMUUUMUMUMMUM... Truncated |
Test 32
Verdict: WRONG ANSWER
input |
---|
200 28 148 28 122 28 137 122 178 ... |
correct output |
---|
Yes UUMUMMMUUMMUMMMUMMUUMUMUMUMMMU... |
user output |
---|
YES MMUMUUUMMUUMUUUMUUMMUMUMUMUUUM... Truncated |
Test 33
Verdict: WRONG ANSWER
input |
---|
200 57 98 57 153 34 153 98 109 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 34
Verdict: WRONG ANSWER
input |
---|
200 6 177 6 20 6 158 88 158 ... |
correct output |
---|
Yes MUUMUMMMUMUUMUUUUUUMUMMMMUUMMU... |
user output |
---|
YES UMMUMUUUMUMMUMMMMMMUMUUUUMMUUM... Truncated |
Test 35
Verdict: WRONG ANSWER
input |
---|
200 142 178 119 142 142 155 119 140 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 36
Verdict: WRONG ANSWER
input |
---|
200 83 150 68 83 68 158 135 158 ... |
correct output |
---|
Yes MMMUUUUUUMUUUMUMUUMMMUMUUUMMUM... |
user output |
---|
YES UUUMMMMMMUMMMUMUMMUUUMUMMMUUMU... Truncated |
Test 37
Verdict: WRONG ANSWER
input |
---|
200 20 177 87 177 121 177 137 177 ... |
correct output |
---|
Yes MMUMUMMMUUUMUMUMMMUMUMUUUUUUMM... |
user output |
---|
YES UUMUMUUUMMMUMUMUUUMUMUMMMMMMUU... Truncated |
Test 38
Verdict: WRONG ANSWER
input |
---|
200 13 139 13 38 13 34 10 38 ... |
correct output |
---|
Yes MUMMUUMUUMUUMMUMMMMUMMUMUUUMMU... |
user output |
---|
YES UMUUMMUMMUMMUUMUUUUMUUMUMMMUUM... Truncated |
Test 39
Verdict: WRONG ANSWER
input |
---|
200 84 198 77 198 52 198 53 77 ... |
correct output |
---|
Yes MMMUMUMMMUUUUMUUUMMMMMUMUMUUUU... |
user output |
---|
YES UUUMUMUUUMMMMUMMMUUUUUMUMUMMMM... Truncated |
Test 40
Verdict: WRONG ANSWER
input |
---|
200 56 112 76 112 56 182 56 114 ... |
correct output |
---|
No |
user output |
---|
NO |
Test 41
Verdict: WRONG ANSWER
input |
---|
200 19 114 19 70 70 86 19 27 ... |
correct output |
---|
Yes MMMUMUUUUUMUMMMMMMMUUMMUMMMMUM... |
user output |
---|
YES UUUMUMMMMMUMUUUUUUUMMUUMUUUUMU... Truncated |
Test 42
Verdict: WRONG ANSWER
input |
---|
1000 811 883 397 883 137 397 546 883 ... |
correct output |
---|
Yes MMMMMUUMUMUUUUUUMUMUMMMMUMMUMM... |
user output |
---|
YES UUUUUMMUMUMMMMMMUMUMUUUUMUUMUU... Truncated |
Test 43
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 393 736 393 398 398 407 351 393 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 44
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 507 955 340 955 507 813 418 955 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 45
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 230 974 230 440 440 752 752 977 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 46
Verdict: WRONG ANSWER
input |
---|
1000 406 944 778 944 68 944 545 778 ... |
correct output |
---|
Yes UMUMMUMUUMUUMUUMUMMUUMUUMUUUUM... |
user output |
---|
YES MUMUUMUMMUMMUMMUMUUMMUMMUMMMMU... Truncated |
Test 47
Verdict: WRONG ANSWER
input |
---|
1000 771 921 368 921 121 921 121 810 ... |
correct output |
---|
Yes UMMUUUUUMUMMUMUMUUUUMMMMUMUUMM... |
user output |
---|
YES MUUMMMMMUMUUMUMUMMMMUUUUMUMMUU... Truncated |
Test 48
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 290 518 518 738 518 554 290 997 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 49
Verdict: WRONG ANSWER
input |
---|
1000 370 791 390 791 390 835 585 835 ... |
correct output |
---|
Yes MMUUUUUMMMUMMUMMMMMMUUMMUMMMMU... |
user output |
---|
YES UUMMMMMUUUMUUMUUUUUUMMUUMUUUUM... Truncated |
Test 50
Verdict: WRONG ANSWER
input |
---|
1000 111 804 778 804 520 804 520 829 ... |
correct output |
---|
Yes MMMUMUUUUUMMMUMMMMMUUMMUMMUUUU... |
user output |
---|
YES UUUMUMMMMMUUUMUUUUUMMUUMUUMMMM... Truncated |
Test 51
Verdict: WRONG ANSWER
input |
---|
1000 627 823 399 627 27 399 27 945 ... |
correct output |
---|
Yes MMUMMMMUUMMUUMUUUUUMUMMUMMMMMU... |
user output |
---|
YES UUMUUUUMMUUMMUMMMMMUMUUMUUUUUM... Truncated |
Test 52
Verdict: RUNTIME ERROR
input |
---|
100000 26991 68205 21905 68205 3029 26991 21905 29288 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 53
Verdict: RUNTIME ERROR
input |
---|
100000 41845 94618 94618 96640 65841 94618 9894 96640 ... |
correct output |
---|
Yes UMUUUMMUUUMMUMMUMUMMMUMMMUMUMU... |
user output |
---|
(empty) |
Test 54
Verdict: RUNTIME ERROR
input |
---|
100000 11081 29940 11081 90273 11081 56653 56653 73314 ... |
correct output |
---|
Yes UMMUUMMMUUMMMMMUUMMUUUMUMMMUUU... |
user output |
---|
(empty) |
Test 55
Verdict: RUNTIME ERROR
input |
---|
100000 27549 31873 27549 48777 48777 71940 48777 59266 ... |
correct output |
---|
Yes MMMMUUMUUMUMUMMUUUMMUMMMUMUUUM... |
user output |
---|
(empty) |
Test 56
Verdict: RUNTIME ERROR
input |
---|
100000 2460 57807 2460 59927 56550 59927 35046 56550 ... |
correct output |
---|
Yes MMMUUMMUMMUUUMMUMUMMMUMUUMUMUM... |
user output |
---|
(empty) |
Test 57
Verdict: RUNTIME ERROR
input |
---|
100000 13089 77222 77222 89616 36711 89616 27645 77222 ... |
correct output |
---|
Yes UMUUUMMMUUUUMMUMMMUUMMUUMUMUMU... |
user output |
---|
(empty) |
Test 58
Verdict: RUNTIME ERROR
input |
---|
100000 35805 70440 70440 82302 64483 82302 64483 96767 ... |
correct output |
---|
Yes MMMUUMMMUUUMMMUUMUUMUMMUUUMUUM... |
user output |
---|
(empty) |
Test 59
Verdict: RUNTIME ERROR
input |
---|
100000 16206 68738 37820 68738 55519 68738 55519 77758 ... |
correct output |
---|
Yes MMUUUMUUMUUMUUMUMMMMMUMUUUUUUU... |
user output |
---|
(empty) |
Test 60
Verdict: RUNTIME ERROR
input |
---|
100000 47137 86808 47137 80136 47137 73346 73346 78144 ... |
correct output |
---|
Yes UUMUMMUUUUMMMMMMMMUUMMMMMMUUMU... |
user output |
---|
(empty) |
Test 61
Verdict: RUNTIME ERROR
input |
---|
100000 39438 53660 53660 60245 20924 60245 20924 38669 ... |
correct output |
---|
No |
user output |
---|
(empty) |