# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
844014 | 2023-09-04T21:56:26 Z | LucaIlie | Longest Trip (IOI23_longesttrip) | C++17 | 723 ms | 600 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 ) { ans.clear(); pairs.clear(); for ( int u = 0; u < n; u++ ) vis[u] = false; 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 } ); if ( vis[u] || vis[v] ) exit( 1 ); 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 | Runtime error | 0 ms | 344 KB | Execution failed because the return code was nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 114 ms | 344 KB | Output is correct |
4 | Correct | 332 ms | 344 KB | Output is correct |
5 | Correct | 723 ms | 600 KB | Output is correct |
# | 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 | 110 ms | 344 KB | Output is correct |
4 | Correct | 353 ms | 344 KB | Output is correct |
5 | Correct | 711 ms | 412 KB | Output is correct |
6 | Correct | 8 ms | 344 KB | Output is correct |
7 | Incorrect | 0 ms | 344 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 21 ms | 344 KB | Output is correct |
3 | Correct | 124 ms | 344 KB | Output is correct |
4 | Correct | 351 ms | 344 KB | Output is correct |
5 | Correct | 689 ms | 412 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Incorrect | 0 ms | 344 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 344 KB | Output is correct |
2 | Correct | 24 ms | 540 KB | Output is correct |
3 | Partially correct | 117 ms | 344 KB | Output is partially correct |
4 | Partially correct | 346 ms | 344 KB | Output is partially correct |
5 | Partially correct | 705 ms | 416 KB | Output is partially correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Incorrect | 1 ms | 344 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |