답안 #558003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
558003 2022-05-06T13:07:06 Z AdamGS The Collection Game (BOI21_swaps) C++17
50 / 100
541 ms 652 KB
#include "swaps.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=507;
int T[LIM];
void solve(int n, int v) {
	rep(i, n) T[i]=i;
	while(v--) {
		vector<pair<int,int>>V;
		for(int i=v%2; i+1<n; i+=2) {
			schedule(T[i]+1, T[i+1]+1);
			V.pb({i, i+1});
		}
		vector<int>P=visit();
		rep(i, P.size()) if(!P[i]) swap(T[V[i].st], T[V[i].nd]);
	}
	vector<int>ans;
	rep(i, n) ans.pb(T[i]+1);
	answer(ans);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:6:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
swaps.cpp:22:3: note: in expansion of macro 'rep'
   22 |   rep(i, P.size()) if(!P[i]) swap(T[V[i].st], T[V[i].nd]);
      |   ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 208 KB Correct
2 Correct 124 ms 208 KB Correct
3 Correct 261 ms 208 KB Correct
4 Correct 484 ms 416 KB Correct
5 Correct 473 ms 388 KB Correct
6 Correct 468 ms 408 KB Correct
7 Correct 541 ms 432 KB Correct
8 Correct 506 ms 372 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 208 KB Correct
2 Correct 96 ms 300 KB Correct
3 Correct 250 ms 208 KB Correct
4 Correct 452 ms 412 KB Correct
5 Correct 502 ms 332 KB Correct
6 Correct 471 ms 652 KB Correct
7 Correct 466 ms 348 KB Correct
8 Correct 488 ms 388 KB Correct
9 Correct 90 ms 380 KB Correct
10 Correct 86 ms 364 KB Correct
11 Correct 87 ms 412 KB Correct
12 Correct 91 ms 396 KB Correct
13 Correct 86 ms 312 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 208 KB Correct
2 Correct 139 ms 208 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 208 KB Correct
2 Correct 139 ms 208 KB Correct
3 Correct 56 ms 208 KB Correct
4 Correct 102 ms 300 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 208 KB Correct
2 Correct 109 ms 208 KB Correct
3 Correct 223 ms 208 KB Correct
4 Correct 444 ms 456 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 208 KB Correct
2 Correct 109 ms 208 KB Correct
3 Correct 223 ms 208 KB Correct
4 Correct 444 ms 456 KB Correct
5 Correct 50 ms 208 KB Correct
6 Correct 98 ms 292 KB Correct
7 Correct 268 ms 208 KB Correct
8 Correct 479 ms 384 KB Correct
9 Correct 434 ms 412 KB Correct
10 Correct 440 ms 376 KB Correct
11 Correct 470 ms 408 KB Correct
12 Correct 487 ms 404 KB Correct
13 Correct 51 ms 208 KB Correct
14 Correct 115 ms 208 KB Correct
15 Correct 247 ms 208 KB Correct
16 Correct 469 ms 512 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 208 KB Correct
2 Correct 111 ms 208 KB Correct
3 Correct 216 ms 208 KB Correct
4 Correct 411 ms 556 KB Correct
5 Correct 43 ms 384 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 208 KB Correct
2 Correct 111 ms 208 KB Correct
3 Correct 216 ms 208 KB Correct
4 Correct 411 ms 556 KB Correct
5 Correct 43 ms 384 KB Correct
6 Correct 61 ms 208 KB Correct
7 Correct 106 ms 208 KB Correct
8 Correct 238 ms 208 KB Correct
9 Correct 447 ms 448 KB Correct
10 Correct 439 ms 412 KB Correct
11 Correct 454 ms 440 KB Correct
12 Correct 411 ms 464 KB Correct
13 Correct 480 ms 496 KB Correct
14 Correct 97 ms 312 KB Correct
15 Correct 86 ms 396 KB Correct
16 Correct 85 ms 304 KB Correct
17 Correct 87 ms 508 KB Correct
18 Correct 91 ms 308 KB Correct
19 Correct 52 ms 208 KB Correct
20 Correct 111 ms 208 KB Correct
21 Correct 246 ms 208 KB Correct
22 Correct 452 ms 600 KB Correct
23 Correct 63 ms 288 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 208 KB Correct
2 Correct 124 ms 208 KB Correct
3 Correct 224 ms 208 KB Correct
4 Correct 486 ms 504 KB Correct
5 Correct 44 ms 304 KB Correct
6 Incorrect 9 ms 284 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 208 KB Correct
2 Correct 124 ms 208 KB Correct
3 Correct 224 ms 208 KB Correct
4 Correct 486 ms 504 KB Correct
5 Correct 44 ms 304 KB Correct
6 Incorrect 9 ms 284 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 208 KB Correct
2 Correct 128 ms 208 KB Correct
3 Correct 223 ms 208 KB Correct
4 Correct 431 ms 324 KB Correct
5 Correct 64 ms 292 KB Correct
6 Incorrect 9 ms 284 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 208 KB Correct
2 Correct 128 ms 208 KB Correct
3 Correct 223 ms 208 KB Correct
4 Correct 431 ms 324 KB Correct
5 Correct 64 ms 292 KB Correct
6 Incorrect 9 ms 284 KB Not correct
7 Halted 0 ms 0 KB -