| Task: | Course Schedule |
| Sender: | ileska |
| Submission time: | 2025-10-01 22:24:02 +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.17 s | details |
| #7 | WRONG ANSWER | 0.17 s | details |
| #8 | WRONG ANSWER | 0.17 s | details |
| #9 | WRONG ANSWER | 0.17 s | details |
| #10 | WRONG ANSWER | 0.17 s | details |
| #11 | WRONG ANSWER | 0.15 s | details |
| #12 | WRONG ANSWER | 0.00 s | details |
| #13 | WRONG ANSWER | 0.00 s | details |
| #14 | WRONG ANSWER | 0.12 s | details |
| #15 | WRONG ANSWER | 0.12 s | details |
| #16 | WRONG ANSWER | 0.00 s | details |
| #17 | RUNTIME ERROR | 0.14 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:40:9: warning: unused variable 'ret' [-Wunused-variable]
40 | int ret = search(ii, cheked, connMap, retArr);
| ^~~Code
#include <iostream>
#include <vector>
#define ll unsigned long long
int search(ll node, std::vector<char> &cheked,
std::vector<std::vector<int>> &connMap, std::vector<ll> &retArr) {
if (cheked[node] == 1)
return -1;
if (cheked[node] == 2)
return 0;
cheked[node] = 1;
for (int neighbour : connMap[node]) {
int ret = search(neighbour, cheked, connMap, retArr);
if (ret == -1) {
return -1;
}
}
retArr.push_back(node);
cheked[node] = 2;
return 0;
}
int main() {
ll courseCount, reqCount;
std::cin >> courseCount;
std::cin >> reqCount;
std::vector<std::vector<int>> connMap(courseCount);
for (ll ii = 0; ii < reqCount; ii++) {
ll start, end, cost;
std::cin >> start;
std::cin >> end;
std::cin >> cost;
connMap[start - 1].push_back(end - 1);
}
std::vector<char> cheked(courseCount, 0);
std::vector<ll> retArr;
for (ll ii = 0; ii < courseCount; ii++) {
int ret = search(ii, cheked, connMap, retArr);
// std::cout << ret << std::endl;
}
for (ll ii = 0; ii < retArr.size() - 1; ii++) {
std::cout << retArr[ii] + 1 << " ";
}
std::cout << retArr[retArr.size() - 1] + 1 << std::endl;
return 0;
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 5 2 2 4 8 9 6 4 ... |
| correct output |
|---|
| 5 7 10 2 1 8 3 9 6 4 |
| user output |
|---|
| 3 8 7 10 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 2 7 1 10 9 5 9 7 ... |
| correct output |
|---|
| 1 8 3 6 10 2 9 4 5 7 |
| user output |
|---|
| 3 1 7 6 9 2 10 5 8 4 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 8 5 2 3 10 1 9 1 ... |
| correct output |
|---|
| 4 6 7 9 10 2 8 3 1 5 |
| user output |
|---|
| 2 7 1 9 5 8 10 4 6 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 5 10 10 3 9 10 6 2 ... |
| correct output |
|---|
| 7 8 6 4 2 1 5 9 10 3 |
| user output |
|---|
| 9 1 10 5 3 2 8 4 7 6 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 2 9 4 8 9 1 10 6 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 6 7 1 9 8 10 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 78359 8853 18190 30703 11401 30087 34627 11535 ... |
| correct output |
|---|
| 2 3 8 9 16 18 21 22 27 34 36 4... |
| user output |
|---|
| 58055 1 2 3 45401 50012 25244 ... |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 32395 2098 67067 31866 31867 67167 78488 33397 ... |
| correct output |
|---|
| 9 11 13 16 22 35 37 38 40 44 5... |
| user output |
|---|
| 1 92433 15464 104 75324 47637 ... |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 19035 36947 13730 46121 99449 77790 15626 11731 ... |
| correct output |
|---|
| 1 7 15 17 18 34 38 41 48 49 51... |
| user output |
|---|
| 24208 66479 34960 57089 84229 ... |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 14188 9709 46541 20871 32203 88809 99879 54779 ... |
| correct output |
|---|
| 6 10 11 16 17 19 21 22 23 28 3... |
| user output |
|---|
| 38908 6751 56989 35266 32704 7... |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 41882 61162 28138 18053 74649 74863 69760 74508 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 19043 34856 54991 60467 37612 ... |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 100000 199998 1 100000 1 100000 2 100000 2 100000 ... |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 3 6 9 12 15 18 21 24 27 30 33 ... |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 2 2 1 2 2 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 2 1 |
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 6 6 1 2 2 3 4 3 4 5 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 2 1 5 4 3 |
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 99999 149997 1 3 3 5 5 7 7 9 ... |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 4 3 1 10 9 7 6 16 15 13 12 22 ... |
Test 15
Verdict: WRONG ANSWER
| input |
|---|
| 100000 149998 2 1 3 2 4 3 5 4 ... |
| correct output |
|---|
| 100000 99999 99998 99997 99996... |
| user output |
|---|
| 1 4 2 3 7 5 6 10 8 9 13 11 12 ... |
Test 16
Verdict: WRONG ANSWER
| input |
|---|
| 6 6 1 2 1 3 2 4 3 5 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 2 1 5 3 4 |
Test 17
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 200000 1 1 1 1 2 2 2 2 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
