# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005941 | 2024-06-23T08:35:27 Z | thelegendary08 | Longest Trip (IOI23_longesttrip) | C++17 | 832 ms | 596 KB |
#include "longesttrip.h" #include<bits/stdc++.h> #define f0r(i,n) for(int i = 0;i<n;i++) #define FOR(i,k,n) for(int i = k;i<n;i++) #define pb push_back #define vi vector<int> #define ll long long int using namespace std; std::vector<int> longest_trip(int N, int D) { vector<vector<bool>> con(N, vector<bool>(N, false)); f0r(i, N){ FOR(j, i+1, N){ con[i][j] = are_connected({i}, {j}); } } vi c1 = {0}; vi c2 = {1}; FOR(i, 2, N){ if(con[c1[c1.size()-1]][i])c1.pb(i); else c2.pb(i); } if(c1.size() == 1)swap(c1, c2); vi ans; if(con[c1[0]][c2[0]]){ for(int i = c2.size() - 1; i>=0; i--)ans.pb(c2[i]); f0r(i, c1.size())ans.pb(c1[i]); } else{ f0r(i,c1.size())ans.pb(c1[i]); f0r(i, c2.size())ans.pb(c2[i]); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 348 KB | Output is correct |
2 | Correct | 27 ms | 348 KB | Output is correct |
3 | Correct | 158 ms | 348 KB | Output is correct |
4 | Correct | 405 ms | 424 KB | Output is correct |
5 | Correct | 808 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 136 ms | 348 KB | Output is correct |
4 | Correct | 410 ms | 348 KB | Output is correct |
5 | Correct | 802 ms | 352 KB | Output is correct |
6 | Incorrect | 1 ms | 344 KB | Incorrect |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 23 ms | 344 KB | Output is correct |
3 | Correct | 161 ms | 344 KB | Output is correct |
4 | Correct | 410 ms | 420 KB | Output is correct |
5 | Correct | 806 ms | 596 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Incorrect |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 348 KB | Output is correct |
2 | Correct | 30 ms | 352 KB | Output is correct |
3 | Partially correct | 165 ms | 356 KB | Output is partially correct |
4 | Partially correct | 410 ms | 428 KB | Output is partially correct |
5 | Partially correct | 832 ms | 344 KB | Output is partially correct |
6 | Incorrect | 1 ms | 344 KB | Incorrect |
7 | Halted | 0 ms | 0 KB | - |