답안 #841028

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841028 2023-09-01T05:40:01 Z jhwest2 가장 긴 여행 (IOI23_longesttrip) C++17
15 / 100
10 ms 296 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> longest_trip(int N, int D)
{
	if (D == 3) {
		vector<int> res(N);
		iota(res.begin(), res.end(), 0);
		return res;
	}
	if (D == 2) {
		deque<int> dq = {0};
		vector<bool> chk(N);
		for (int i = 1; i < N; i++) {
			if (are_connected({0}, {i})) {
				dq.push_back(i);
				chk[i] = true;
				break;
			}
		}
		for (int i = 1; i < N; i++) {
			if (chk[i]) continue;
			if (are_connected({i}, {dq.back()}))
				dq.push_back(i);
			else
				dq.push_front(i);
		}
		return vector<int>(dq.begin(), dq.end());
	}
	return {0};
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 9 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 8 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
8 Correct 9 ms 208 KB Output is correct
9 Correct 8 ms 208 KB Output is correct
10 Correct 7 ms 208 KB Output is correct
11 Correct 6 ms 296 KB Output is correct
12 Correct 8 ms 208 KB Output is correct
13 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -