답안 #959767

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
959767 2024-04-09T04:02:46 Z josanneo22 The Collection Game (BOI21_swaps) C++17
50 / 100
37 ms 1924 KB
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

#define L(i,j,k) for(int i=(j);i<=(k);++i)
#define R(i,j,k) for(int i=(j);i>=(k);--i)
#define rep(i, n) L(i, 1, n)
#define all(x) x.begin(),x.end()
#define me(x,a) memset(x,a,sizeof(x))

#include<random>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      
#include "swaps.h"

const int nax = 505;
int a[nax];
void odd_even(int N,int V) {
	if (N == 1) {
		answer({ 1 });
		return;
	}
	L(i, 1, N) a[i] = i;
	int par = 0;
	for (int t = 0; t < N; t++) {
		int st = 1 + (par == 1);
		vector<pair<int,int>> q;
		for (int i = st; i + 1 <= N; i += 2) {
			schedule(a[i], a[i + 1]);
			q.push_back(make_pair(i, i + 1));
		}
		vector<int> res = visit();
		for (int i = 0; i < (int)res.size(); i++) {
			if (res[i] == 0) {
				swap(a[q[i].first], a[q[i].second]);
			}
		}
		par ^= 1;
	}
	vector<int> ans;
	L(i, 1, N) ans.push_back(a[i]);
	answer(ans);
	return;
}
void solve(int N, int V) {
	odd_even(N, V);
	return;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 344 KB Correct
3 Correct 10 ms 344 KB Correct
4 Correct 33 ms 928 KB Correct
5 Correct 32 ms 1432 KB Correct
6 Correct 34 ms 1184 KB Correct
7 Correct 32 ms 928 KB Correct
8 Correct 32 ms 1684 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 34 ms 1428 KB Correct
5 Correct 36 ms 1672 KB Correct
6 Correct 33 ms 1680 KB Correct
7 Correct 34 ms 1180 KB Correct
8 Correct 32 ms 956 KB Correct
9 Correct 35 ms 1180 KB Correct
10 Correct 33 ms 1200 KB Correct
11 Correct 34 ms 1680 KB Correct
12 Correct 32 ms 1428 KB Correct
13 Correct 34 ms 1428 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 1 ms 344 KB Correct
4 Correct 2 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 32 ms 1176 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 32 ms 1176 KB Correct
5 Correct 0 ms 344 KB Correct
6 Correct 2 ms 344 KB Correct
7 Correct 9 ms 344 KB Correct
8 Correct 33 ms 1432 KB Correct
9 Correct 33 ms 1676 KB Correct
10 Correct 34 ms 1924 KB Correct
11 Correct 37 ms 1176 KB Correct
12 Correct 32 ms 928 KB Correct
13 Correct 1 ms 344 KB Correct
14 Correct 3 ms 344 KB Correct
15 Correct 10 ms 344 KB Correct
16 Correct 33 ms 672 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 36 ms 924 KB Correct
5 Correct 34 ms 1172 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 36 ms 924 KB Correct
5 Correct 34 ms 1172 KB Correct
6 Correct 1 ms 344 KB Correct
7 Correct 2 ms 344 KB Correct
8 Correct 9 ms 344 KB Correct
9 Correct 32 ms 924 KB Correct
10 Correct 34 ms 1424 KB Correct
11 Correct 32 ms 1436 KB Correct
12 Correct 35 ms 960 KB Correct
13 Correct 34 ms 1208 KB Correct
14 Correct 33 ms 696 KB Correct
15 Correct 32 ms 948 KB Correct
16 Correct 32 ms 1636 KB Correct
17 Correct 32 ms 1428 KB Correct
18 Correct 33 ms 1676 KB Correct
19 Correct 0 ms 344 KB Correct
20 Correct 2 ms 344 KB Correct
21 Correct 10 ms 344 KB Correct
22 Correct 36 ms 1428 KB Correct
23 Correct 33 ms 924 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 340 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 34 ms 1456 KB Correct
5 Correct 32 ms 1176 KB Correct
6 Runtime error 7 ms 672 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 340 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 34 ms 1456 KB Correct
5 Correct 32 ms 1176 KB Correct
6 Runtime error 7 ms 672 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 35 ms 928 KB Correct
5 Correct 32 ms 672 KB Correct
6 Runtime error 7 ms 752 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 2 ms 344 KB Correct
3 Correct 9 ms 344 KB Correct
4 Correct 35 ms 928 KB Correct
5 Correct 32 ms 672 KB Correct
6 Runtime error 7 ms 752 KB Execution killed with signal 13
7 Halted 0 ms 0 KB -