# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1059655 | 2024-08-15T06:46:37 Z | tolbi | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 176 ms | 504 KB |
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; //bool are_connected(std::vector<int> A, std::vector<int> B); bool sor(int x, int y){ std::vector<int> ilk; std::vector<int> iki; ilk.push_back(x); iki.push_back(y); return are_connected(ilk,iki); } std::vector<int> longest_trip(int N, int D) { std::vector<int> ans; ans.push_back(0); std::vector<bool> vis(N,false); vis[0]=true; while (ans.size()<N-1){ for (int i = 0; i < N; i++){ if (vis[i]) continue; if (sor(ans.back(),i)){ ans.push_back(i); vis[i]=true; break; } } } int kalan = -1; for (int i = 0; i < N; i++){ if (!vis[i]){ kalan=i; break; } } if (kalan==-1) return ans; else { if (sor(ans[0],kalan)){ reverse(ans.begin(), ans.end()); ans.push_back(kalan); reverse(ans.begin(), ans.end()); } else { ans.push_back(kalan); } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 176 ms | 344 KB | too many calls |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 504 KB | Output is correct |
2 | Correct | 5 ms | 344 KB | Output is correct |
3 | Correct | 6 ms | 344 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
5 | Correct | 5 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 344 KB | Output is correct |
2 | Correct | 5 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
5 | Correct | 7 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Correct | 5 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 344 KB | Output is correct |
9 | Correct | 7 ms | 344 KB | Output is correct |
10 | Correct | 4 ms | 344 KB | Output is correct |
11 | Correct | 5 ms | 432 KB | Output is correct |
12 | Correct | 5 ms | 344 KB | Output is correct |
13 | Correct | 7 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 348 KB | Output is correct |
2 | Correct | 5 ms | 348 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 7 ms | 348 KB | Output is correct |
5 | Correct | 5 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 352 KB | Output is correct |
7 | Correct | 5 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 344 KB | Output is correct |
9 | Correct | 7 ms | 344 KB | Output is correct |
10 | Correct | 5 ms | 344 KB | Output is correct |
11 | Correct | 5 ms | 344 KB | Output is correct |
12 | Correct | 5 ms | 344 KB | Output is correct |
13 | Correct | 5 ms | 344 KB | Output is correct |
14 | Incorrect | 0 ms | 344 KB | Incorrect |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 7 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
5 | Correct | 7 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Correct | 6 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 344 KB | Output is correct |
9 | Correct | 10 ms | 344 KB | Output is correct |
10 | Correct | 8 ms | 344 KB | Output is correct |
11 | Correct | 7 ms | 432 KB | Output is correct |
12 | Correct | 5 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 344 KB | Output is correct |
14 | Incorrect | 0 ms | 344 KB | Incorrect |
15 | Halted | 0 ms | 0 KB | - |