# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005937 | 2024-06-23T08:25:58 Z | thelegendary08 | Longest Trip (IOI23_longesttrip) | C++17 | 843 ms | 592 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[0][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 | 0 ms | 348 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 22 ms | 356 KB | Output is correct |
3 | Correct | 145 ms | 348 KB | Output is correct |
4 | Correct | 390 ms | 424 KB | Output is correct |
5 | Correct | 838 ms | 356 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 22 ms | 344 KB | Output is correct |
3 | Correct | 144 ms | 344 KB | Output is correct |
4 | Correct | 394 ms | 592 KB | Output is correct |
5 | Correct | 805 ms | 344 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 | 6 ms | 344 KB | Output is correct |
2 | Correct | 26 ms | 344 KB | Output is correct |
3 | Correct | 140 ms | 344 KB | Output is correct |
4 | Correct | 423 ms | 436 KB | Output is correct |
5 | Correct | 810 ms | 344 KB | Output is correct |
6 | Incorrect | 0 ms | 344 KB | Incorrect |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 28 ms | 344 KB | Output is correct |
3 | Partially correct | 133 ms | 344 KB | Output is partially correct |
4 | Partially correct | 385 ms | 592 KB | Output is partially correct |
5 | Partially correct | 843 ms | 340 KB | Output is partially correct |
6 | Incorrect | 0 ms | 344 KB | Incorrect |
7 | Halted | 0 ms | 0 KB | - |