# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
888753 | ZHIRDILBILDIZ | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 6 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "longesttrip.h"
#define fi first
#define se second
#define ll long long
using namespace std;
const int N = 256;
//bool gr[N + 1][N + 1];
//bool are_connected(vector<int> a, vector<int> b) {
// for (int i : a)
// for (int j : b)
// if (gr[i][j])
// return 1;
// return 0;
//}
vector<int> longest_trip(int n, int d) {
vector<int> v;
bool us[N + 1][N + 1] = {};
int dp[N + 1] = {};
for (int i = 0; i < n; ++i)
us[i][i] = 1;
if (d == 3) {
for (int i = 0; i < n; ++i)
v.push_back(i);
return v;
}
if (d == 2) {
v.push_back(0);
int abu = 1;
for (int i = 0; i < n - 1, abu < n;) {
vector<int> a = {i}, b = {abu};
if (are_connected(a, b)) {
v.push_back(abu);
i = abu;
++abu;
} else {
if (abu < n - 2) {
v.push_back(abu + 1);
v.push_back(abu);
i = abu;
abu += 2;
} else
break;
}
}
return v;
}
}
//signed main() {
// ios::sync_with_stdio(0);
// cin.tie(0); cout.tie(0);
// int n, d, m;
// cin >> n >> d >> m;
// for (int i = 1; i <= m; ++i) {
// int a, b;
// cin >> a >> b;
// gr[a][b] = gr[b][a] = 1;
// }
// vector<int> ans = longest_trip(n, d);
// cout << ans.size() << '\n';
// for (int i : ans)
// cout << i << ' ';
// cout << "\nare connected\n";
// return 0;
//}
//5 2 8
//0 2
//0 3
//0 4
//1 2
//1 3
//1 4
//2 4
//3 4
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |