# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1080881 | 2024-08-29T15:40:01 Z | asdasdqwer | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 1000 ms | 1236 KB |
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; std::vector<int> longest_trip(int N, int D) { vector<vector<int>> g(N); if (D == 3) { vector<int> v; for (int i=0;i<N;i++) { v.push_back(i); } return v; } for (int i=0;i<N;i++) { for (int j=i+1;j<N;j++) { if (are_connected({i}, {j})) { g[i].push_back(j); g[j].push_back(i); } } } int tries = 100; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> lng; for (int i=0;i<tries;i++) { vector<int> tmp; vector<bool> vis(N, false); function<void(int)> dfs=[&](int node) { vis[node] = true; tmp.push_back(node); vector<int> suf; for (int j=0;j<g[node].size();j++)suf.push_back(j); shuffle(suf.begin(), suf.end(), rng); for (int x:suf) { if (!vis[g[node][x]]) { dfs(g[node][x]); break; } } }; dfs(uniform_int_distribution<int>(0, N-1)(rng)); if (lng.size() < tmp.size()) { lng = tmp; } } return lng; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 257 ms | 1028 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 16 ms | 344 KB | Output is correct |
2 | Correct | 44 ms | 344 KB | Output is correct |
3 | Correct | 207 ms | 344 KB | Output is correct |
4 | Correct | 542 ms | 1236 KB | Output is correct |
5 | Execution timed out | 1014 ms | 1188 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 344 KB | Output is correct |
2 | Correct | 45 ms | 344 KB | Output is correct |
3 | Correct | 199 ms | 460 KB | Output is correct |
4 | Correct | 536 ms | 592 KB | Output is correct |
5 | Execution timed out | 1061 ms | 988 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 344 KB | Output is correct |
2 | Correct | 49 ms | 344 KB | Output is correct |
3 | Partially correct | 228 ms | 344 KB | Output is partially correct |
4 | Partially correct | 536 ms | 732 KB | Output is partially correct |
5 | Execution timed out | 1051 ms | 1112 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |