Task: | Distinct Routes |
Sender: | odanobunaga8199 |
Submission time: | 2024-10-21 17:33:19 +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.01 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | ACCEPTED | 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 |
Code
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; if(n < 2){ cout << "0"; return 0; } vector<int> forbidden1; vector<int> forbiddenn; for(int i=0; i<m; i++){ int a, b; cin >> a >> b; if(a == 1){ forbidden1.push_back(b); } if(b == 1){ forbidden1.push_back(a); } if(a == n){ forbiddenn.push_back(b); } if(b == n){ forbiddenn.push_back(a); } } sort(forbidden1.begin(), forbidden1.end()); sort(forbiddenn.begin(), forbiddenn.end()); bool found = false; int intermediate = -1; for(int k=2; k<=n-1; k++){ bool forbidden_with_1 = binary_search(forbidden1.begin(), forbidden1.end(), k); if(forbidden_with_1){ continue; } bool forbidden_with_n = binary_search(forbiddenn.begin(), forbiddenn.end(), k); if(forbidden_with_n){ continue; } intermediate = k; found = true; break; } if(found){ cout << "3\n1 " << intermediate << " " << n; } else{ bool direct_forbidden = binary_search(forbidden1.begin(), forbidden1.end(), n); if(!direct_forbidden){ cout << "2\n1 " << n; return 0; } cout << "0"; } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
2 1 1 2 |
correct output |
---|
1 2 1 2 |
user output |
---|
0 |
Test 2
Verdict: WRONG ANSWER
input |
---|
4 2 1 2 3 4 |
correct output |
---|
0 |
user output |
---|
2 1 4 |
Test 3
Verdict: WRONG ANSWER
input |
---|
500 996 1 2 2 500 1 3 3 500 ... |
correct output |
---|
498 3 1 2 500 3 1 3 500 ... |
user output |
---|
2 1 500 |
Test 4
Verdict: WRONG ANSWER
input |
---|
500 499 1 2 2 3 3 4 4 5 ... |
correct output |
---|
1 500 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
3 1 3 500 |
Test 5
Verdict: ACCEPTED
input |
---|
2 1 2 1 |
correct output |
---|
0 |
user output |
---|
0 |
Test 6
Verdict: WRONG ANSWER
input |
---|
40 1000 25 22 15 24 7 33 16 32 ... |
correct output |
---|
21 44 1 35 39 34 29 32 22 38 20 30 1... |
user output |
---|
3 1 12 40 |
Test 7
Verdict: WRONG ANSWER
input |
---|
75 1000 72 6 46 66 63 45 70 46 ... |
correct output |
---|
12 30 1 29 24 9 18 63 45 31 66 72 6 ... |
user output |
---|
3 1 2 75 |
Test 8
Verdict: WRONG ANSWER
input |
---|
100 1000 75 97 7 62 88 25 36 44 ... |
correct output |
---|
9 51 1 35 15 86 79 34 43 94 83 75 9... |
user output |
---|
3 1 3 100 |
Test 9
Verdict: WRONG ANSWER
input |
---|
3 2 1 2 2 3 |
correct output |
---|
1 3 1 2 3 |
user output |
---|
2 1 3 |
Test 10
Verdict: WRONG ANSWER
input |
---|
11 12 1 2 2 3 3 4 4 5 ... |
correct output |
---|
2 6 1 2 3 4 5 11 7 1 6 7 8 9 10 11 |
user output |
---|
3 1 3 11 |
Test 11
Verdict: WRONG ANSWER
input |
---|
8 9 1 2 2 3 3 8 1 4 ... |
correct output |
---|
2 5 1 2 6 7 8 5 1 4 5 3 8 |
user output |
---|
3 1 5 8 |
Test 12
Verdict: WRONG ANSWER
input |
---|
8 9 1 2 1 3 2 3 3 4 ... |
correct output |
---|
1 8 1 2 3 4 5 6 7 8 |
user output |
---|
3 1 4 8 |
Test 13
Verdict: WRONG ANSWER
input |
---|
7 9 1 2 1 3 2 7 3 4 ... |
correct output |
---|
3 3 1 2 7 4 1 3 5 7 ... |
user output |
---|
2 1 7 |
Test 14
Verdict: WRONG ANSWER
input |
---|
7 15 3 6 5 2 5 4 3 5 ... |
correct output |
---|
2 5 1 2 3 6 7 4 1 4 5 7 |
user output |
---|
3 1 3 7 |
Test 15
Verdict: WRONG ANSWER
input |
---|
500 986 244 252 224 22 81 484 273 432 ... |
correct output |
---|
116 5 1 129 142 473 500 5 1 63 158 171 500 ... |
user output |
---|
3 1 2 500 |