답안 #417840

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417840 2021-06-04T11:43:50 Z Kevin_Zhang_TW The Collection Game (BOI21_swaps) C++17
35 / 100
129 ms 484 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
#include "swaps.h"

const int MAX_N = 300010;

void solve(int N, int V) {

	vector<int> id(N); iota(AI(id), 1);

	for (int i = 0;i < N+N;++i) {
		vector<pair<int,int>> comp;
		for (int j = i&1;j+1 < N;j += 2) { 
			schedule(id[j], id[j+1]);
			comp.pb(j, j+1);
		}
		vector<int> ret = visit();
		for (int j = 0;j < ret.size();++j) {
			if (ret[j] == 0) {
				auto [x, y] = comp[j];
				swap(id[x], id[y]);
			}
		}
	}

	answer(id);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   for (int j = 0;j < ret.size();++j) {
      |                  ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 9 ms 292 KB Correct
3 Correct 29 ms 200 KB Correct
4 Correct 102 ms 408 KB Correct
5 Correct 98 ms 300 KB Correct
6 Correct 113 ms 376 KB Correct
7 Correct 112 ms 300 KB Correct
8 Correct 122 ms 368 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 8 ms 200 KB Correct
3 Correct 33 ms 200 KB Correct
4 Correct 109 ms 300 KB Correct
5 Correct 113 ms 356 KB Correct
6 Correct 129 ms 296 KB Correct
7 Correct 113 ms 384 KB Correct
8 Correct 117 ms 296 KB Correct
9 Correct 103 ms 300 KB Correct
10 Correct 99 ms 308 KB Correct
11 Correct 100 ms 396 KB Correct
12 Correct 108 ms 292 KB Correct
13 Correct 104 ms 484 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 7 ms 288 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 7 ms 288 KB Correct
3 Correct 1 ms 200 KB Correct
4 Correct 6 ms 292 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 6 ms 320 KB Correct
3 Correct 27 ms 200 KB Correct
4 Correct 104 ms 408 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 6 ms 320 KB Correct
3 Correct 27 ms 200 KB Correct
4 Correct 104 ms 408 KB Correct
5 Correct 1 ms 200 KB Correct
6 Correct 6 ms 296 KB Correct
7 Correct 30 ms 200 KB Correct
8 Correct 107 ms 372 KB Correct
9 Correct 103 ms 300 KB Correct
10 Correct 124 ms 380 KB Correct
11 Correct 100 ms 384 KB Correct
12 Correct 109 ms 368 KB Correct
13 Correct 1 ms 200 KB Correct
14 Correct 7 ms 200 KB Correct
15 Correct 35 ms 200 KB Correct
16 Correct 111 ms 388 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 6 ms 200 KB Correct
3 Correct 28 ms 200 KB Correct
4 Correct 108 ms 348 KB Correct
5 Runtime error 51 ms 284 KB Execution killed with signal 13
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 6 ms 200 KB Correct
3 Correct 28 ms 200 KB Correct
4 Correct 108 ms 348 KB Correct
5 Runtime error 51 ms 284 KB Execution killed with signal 13
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 6 ms 200 KB Correct
3 Correct 33 ms 200 KB Correct
4 Correct 124 ms 372 KB Correct
5 Runtime error 59 ms 328 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 6 ms 200 KB Correct
3 Correct 33 ms 200 KB Correct
4 Correct 124 ms 372 KB Correct
5 Runtime error 59 ms 328 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 8 ms 272 KB Correct
3 Correct 30 ms 200 KB Correct
4 Correct 102 ms 300 KB Correct
5 Runtime error 55 ms 448 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 8 ms 272 KB Correct
3 Correct 30 ms 200 KB Correct
4 Correct 102 ms 300 KB Correct
5 Runtime error 55 ms 448 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -