# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
850145 | 2023-09-15T21:24:19 Z | Rifal | Longest Trip (IOI23_longesttrip) | C++17 | 6 ms | 600 KB |
#include "longesttrip.h" using namespace std; #include<bits/stdc++.h> std::vector<int> longest_trip(int N, int D) { vector<int> ans; if(D == 3) { for(int i = 0; i < N; i++) { ans.push_back(i); } } else if(D == 2) { set<int> st; deque<int> dq; for(int i = 1; i < N; i++) st.insert(i); dq.push_back(0); if(are_connected({dq.back()}, {1}) == true) { dq.push_back(1); st.erase(1); } else { dq.push_back(2); st.erase(2); } for(auto i : st) { if(are_connected({dq.back()}, {i}) == true) { dq.push_back(i); } else { dq.push_front(i); } } for(int i = 0; i < dq.size(); i++) { ans.push_back(dq[i]); } } else { } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 6 ms | 344 KB | Output is correct |
3 | Correct | 4 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 4 ms | 344 KB | Output is correct |
6 | Correct | 5 ms | 344 KB | Output is correct |
7 | Correct | 5 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 344 KB | Output is correct |
9 | Correct | 4 ms | 344 KB | Output is correct |
10 | Correct | 5 ms | 600 KB | Output is correct |
11 | Correct | 4 ms | 600 KB | Output is correct |
12 | Correct | 4 ms | 344 KB | Output is correct |
13 | Correct | 5 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |