# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
858547 | 2023-10-08T17:30:31 Z | ikura355 | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 11 ms | 600 KB |
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; std::vector<int> longest_trip(int n, int density) { if (density == 3) { // Return list of 0 to N-1 vector<int> ans(n); iota(ans.begin(), ans.end(), 0); return ans; } else if (density == 2) { vector<int> nxt(n); int pair; for (int i = 1; i < n; i++) if (are_connected({0}, {i})) pair = i; int head = 0, tail = pair; nxt[head] = pair; for (int i = 0; i < n; i++) { if (i == 0 || i == pair) continue; if (are_connected({head}, {i})) { nxt[i] = head; head = i; } else { nxt[tail] = i; tail = i; } } vector<int> ans; while (true) { ans.push_back(head); if (head == tail) break; head = nxt[head]; } return ans; } return {}; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 340 KB | Output is correct |
2 | Correct | 8 ms | 344 KB | Output is correct |
3 | Correct | 8 ms | 344 KB | Output is correct |
4 | Correct | 8 ms | 344 KB | Output is correct |
5 | Correct | 11 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Correct | 7 ms | 344 KB | Output is correct |
8 | Correct | 9 ms | 344 KB | Output is correct |
9 | Correct | 8 ms | 344 KB | Output is correct |
10 | Correct | 10 ms | 436 KB | Output is correct |
11 | Correct | 9 ms | 600 KB | Output is correct |
12 | Correct | 8 ms | 600 KB | Output is correct |
13 | Correct | 8 ms | 600 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |