# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
844011 | 2023-09-04T21:54:21 Z | LucaIlie | Longest Trip (IOI23_longesttrip) | C++17 | 0 ms | 344 KB |
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 256; int vis[MAX_N]; vector<pair<int, int>> pairs; vector<int> ans; vector<int> longest_trip( int n, int d ) { for ( int u = 0; u < n; u++ ) { for ( int v = u + 1; v < n; v++ ) { int x = are_connected( { u }, { v } ); if ( !x ) { pairs.push_back( { u, v } ); vis[u] = vis[v] = true; } } } for ( int i = 0; i < pairs.size(); i++ ) ans.push_back( pairs[i].first ); for ( int u = 0; u < n; u++ ) { if ( !vis[u] ) ans.push_back( u ); } if ( n == 2 && pairs.size() == 1 ) return ans; for ( int i = pairs.size() - 1; i >= 0; i-- ) ans.push_back( pairs[i].second ); 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 | 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 | - |
# | 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 | - |