# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844012 | 2023-09-04T21:55:29 Z | LucaIlie | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 790 ms | 416 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 } ); 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 29 ms | 344 KB | Output is correct |
3 | Correct | 123 ms | 344 KB | Output is correct |
4 | Correct | 363 ms | 344 KB | Output is correct |
5 | Correct | 790 ms | 412 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 117 ms | 344 KB | Output is correct |
4 | Correct | 357 ms | 344 KB | Output is correct |
5 | Correct | 730 ms | 416 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 23 ms | 344 KB | Output is correct |
3 | Correct | 153 ms | 340 KB | Output is correct |
4 | Correct | 375 ms | 344 KB | Output is correct |
5 | Correct | 760 ms | 408 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Incorrect | 0 ms | 340 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 22 ms | 344 KB | Output is correct |
3 | Partially correct | 114 ms | 340 KB | Output is partially correct |
4 | Partially correct | 345 ms | 344 KB | Output is partially correct |
5 | Partially correct | 739 ms | 416 KB | Output is partially correct |
6 | Correct | 8 ms | 344 KB | Output is correct |
7 | Incorrect | 1 ms | 344 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |