답안 #776008

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776008 2023-07-07T08:18:43 Z 박영우(#9993) The Collection Game (BOI21_swaps) C++17
50 / 100
47 ms 4036 KB
#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
typedef pair<int, int> pii;

#define MAX 101010

int ans[MAX];
vector<pii> qv[MAX];

void simulate(int V) {
	int i;
	for (i = 1; i <= V; i++) {
		if (qv[i].empty()) continue;
		for (auto& [a, b] : qv[i]) schedule(ans[a], ans[b]);
		auto res = visit();
		int p = 0;
		for (auto& [a, b] : qv[i]) if (!res[p++]) swap(ans[a], ans[b]);
	}
}

void solve(int N, int V) {
	int i;
	for (i = 1; i <= N; i++) ans[i] = i;

	for (i = 1; i <= N; i++) {
		int j;
		for (j = 2 - (i & 1); j <= N; j += 2) if (j + 1 <= N) qv[i].emplace_back(j, j + 1);
	}


	simulate(N);
	vector<int> ansv;
	for (i = 1; i <= N; i++) ansv.push_back(ans[i]);
	answer(ansv);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 3 ms 2640 KB Correct
3 Correct 11 ms 2896 KB Correct
4 Correct 36 ms 3700 KB Correct
5 Correct 40 ms 3700 KB Correct
6 Correct 36 ms 3700 KB Correct
7 Correct 35 ms 3700 KB Correct
8 Correct 38 ms 3692 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 4 ms 2640 KB Correct
3 Correct 11 ms 2896 KB Correct
4 Correct 40 ms 3696 KB Correct
5 Correct 34 ms 3696 KB Correct
6 Correct 42 ms 3704 KB Correct
7 Correct 41 ms 3692 KB Correct
8 Correct 37 ms 3700 KB Correct
9 Correct 38 ms 3700 KB Correct
10 Correct 44 ms 3764 KB Correct
11 Correct 36 ms 3700 KB Correct
12 Correct 42 ms 4008 KB Correct
13 Correct 36 ms 3688 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2640 KB Correct
2 Correct 4 ms 2640 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2640 KB Correct
2 Correct 4 ms 2640 KB Correct
3 Correct 1 ms 2596 KB Correct
4 Correct 4 ms 2640 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2640 KB Correct
2 Correct 3 ms 2640 KB Correct
3 Correct 16 ms 2896 KB Correct
4 Correct 35 ms 3700 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2640 KB Correct
2 Correct 3 ms 2640 KB Correct
3 Correct 16 ms 2896 KB Correct
4 Correct 35 ms 3700 KB Correct
5 Correct 1 ms 2640 KB Correct
6 Correct 4 ms 2640 KB Correct
7 Correct 11 ms 2896 KB Correct
8 Correct 38 ms 3696 KB Correct
9 Correct 39 ms 3692 KB Correct
10 Correct 47 ms 3692 KB Correct
11 Correct 43 ms 3692 KB Correct
12 Correct 36 ms 3692 KB Correct
13 Correct 2 ms 2640 KB Correct
14 Correct 4 ms 2640 KB Correct
15 Correct 11 ms 2896 KB Correct
16 Correct 37 ms 4036 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 3 ms 2640 KB Correct
3 Correct 11 ms 2896 KB Correct
4 Correct 38 ms 3788 KB Correct
5 Correct 40 ms 3696 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 3 ms 2640 KB Correct
3 Correct 11 ms 2896 KB Correct
4 Correct 38 ms 3788 KB Correct
5 Correct 40 ms 3696 KB Correct
6 Correct 2 ms 2640 KB Correct
7 Correct 3 ms 2640 KB Correct
8 Correct 11 ms 2896 KB Correct
9 Correct 39 ms 3680 KB Correct
10 Correct 35 ms 3696 KB Correct
11 Correct 34 ms 3704 KB Correct
12 Correct 36 ms 3704 KB Correct
13 Correct 37 ms 3692 KB Correct
14 Correct 37 ms 3696 KB Correct
15 Correct 39 ms 3704 KB Correct
16 Correct 34 ms 3692 KB Correct
17 Correct 35 ms 3700 KB Correct
18 Correct 36 ms 3700 KB Correct
19 Correct 1 ms 2640 KB Correct
20 Correct 3 ms 2640 KB Correct
21 Correct 14 ms 2896 KB Correct
22 Correct 36 ms 3784 KB Correct
23 Correct 36 ms 3692 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 3 ms 2640 KB Correct
3 Correct 11 ms 2896 KB Correct
4 Correct 34 ms 3696 KB Correct
5 Correct 35 ms 3696 KB Correct
6 Runtime error 11 ms 3672 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 3 ms 2640 KB Correct
3 Correct 11 ms 2896 KB Correct
4 Correct 34 ms 3696 KB Correct
5 Correct 35 ms 3696 KB Correct
6 Runtime error 11 ms 3672 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 4 ms 2640 KB Correct
3 Correct 14 ms 2896 KB Correct
4 Correct 36 ms 3708 KB Correct
5 Correct 35 ms 3696 KB Correct
6 Runtime error 12 ms 3672 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2640 KB Correct
2 Correct 4 ms 2640 KB Correct
3 Correct 14 ms 2896 KB Correct
4 Correct 36 ms 3708 KB Correct
5 Correct 35 ms 3696 KB Correct
6 Runtime error 12 ms 3672 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -