답안 #522846

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
522846 2022-02-06T03:51:22 Z OJtester The Collection Game (BOI21_swaps) C++17
50 / 100
59 ms 536 KB
//Forwarded from QOJ19590
#include "swaps.h"
#include <bits/stdc++.h>
#define pi pair<int,int>
#define mk make_pair
#define rep(i,  a) for(register int i=1,i##end=a;i<=i##end;i++)
using namespace std;
void solve(int n, int D) {
	vector<int>ans;ans.resize(n);
	rep(i,n)ans[i-1]=i;
	for (int i=0;i<500;i++) {
		vector<pi>A;
		for(int j=i%2;j+1<ans.size();j+=2) {
			schedule(ans[j],ans[j+1]);
			A.push_back(mk(j,j+1));
		}
		if(!A.empty()){
			auto res=visit();
			for(int j=0;j<A.size();j++)
				if(!res[j])swap(ans[A[j].first],ans[A[j].second]);
		}
	}
	answer(ans);return;
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:10:6: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 |  rep(i,n)ans[i-1]=i;
      |      ^
swaps.cpp:6:37: note: in definition of macro 'rep'
    6 | #define rep(i,  a) for(register int i=1,i##end=a;i<=i##end;i++)
      |                                     ^
swaps.cpp:10:6: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 |  rep(i,n)ans[i-1]=i;
      |      ^
swaps.cpp:6:41: note: in definition of macro 'rep'
    6 | #define rep(i,  a) for(register int i=1,i##end=a;i<=i##end;i++)
      |                                         ^
swaps.cpp:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   for(int j=i%2;j+1<ans.size();j+=2) {
      |                 ~~~^~~~~~~~~~~
swaps.cpp:19:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    for(int j=0;j<A.size();j++)
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Correct
2 Correct 13 ms 280 KB Correct
3 Correct 35 ms 200 KB Correct
4 Correct 44 ms 296 KB Correct
5 Correct 43 ms 300 KB Correct
6 Correct 48 ms 280 KB Correct
7 Correct 48 ms 420 KB Correct
8 Correct 46 ms 400 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Correct
2 Correct 16 ms 200 KB Correct
3 Correct 24 ms 200 KB Correct
4 Correct 47 ms 324 KB Correct
5 Correct 58 ms 300 KB Correct
6 Correct 41 ms 300 KB Correct
7 Correct 44 ms 296 KB Correct
8 Correct 59 ms 496 KB Correct
9 Correct 46 ms 300 KB Correct
10 Correct 42 ms 296 KB Correct
11 Correct 44 ms 296 KB Correct
12 Correct 48 ms 400 KB Correct
13 Correct 39 ms 300 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Correct
2 Correct 15 ms 272 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Correct
2 Correct 15 ms 272 KB Correct
3 Correct 5 ms 200 KB Correct
4 Correct 13 ms 200 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Correct
2 Correct 17 ms 320 KB Correct
3 Correct 25 ms 200 KB Correct
4 Correct 48 ms 300 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Correct
2 Correct 17 ms 320 KB Correct
3 Correct 25 ms 200 KB Correct
4 Correct 48 ms 300 KB Correct
5 Correct 5 ms 200 KB Correct
6 Correct 21 ms 272 KB Correct
7 Correct 27 ms 200 KB Correct
8 Correct 43 ms 352 KB Correct
9 Correct 46 ms 296 KB Correct
10 Correct 41 ms 428 KB Correct
11 Correct 45 ms 536 KB Correct
12 Correct 46 ms 300 KB Correct
13 Correct 6 ms 268 KB Correct
14 Correct 16 ms 200 KB Correct
15 Correct 29 ms 200 KB Correct
16 Correct 45 ms 404 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 200 KB Correct
2 Correct 17 ms 284 KB Correct
3 Correct 24 ms 200 KB Correct
4 Correct 58 ms 296 KB Correct
5 Correct 43 ms 364 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 200 KB Correct
2 Correct 17 ms 284 KB Correct
3 Correct 24 ms 200 KB Correct
4 Correct 58 ms 296 KB Correct
5 Correct 43 ms 364 KB Correct
6 Correct 6 ms 200 KB Correct
7 Correct 9 ms 328 KB Correct
8 Correct 21 ms 200 KB Correct
9 Correct 53 ms 296 KB Correct
10 Correct 43 ms 380 KB Correct
11 Correct 57 ms 300 KB Correct
12 Correct 45 ms 300 KB Correct
13 Correct 51 ms 404 KB Correct
14 Correct 42 ms 296 KB Correct
15 Correct 52 ms 304 KB Correct
16 Correct 59 ms 372 KB Correct
17 Correct 41 ms 300 KB Correct
18 Correct 43 ms 300 KB Correct
19 Correct 6 ms 200 KB Correct
20 Correct 15 ms 272 KB Correct
21 Correct 28 ms 200 KB Correct
22 Correct 43 ms 304 KB Correct
23 Correct 57 ms 392 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Correct
2 Correct 20 ms 268 KB Correct
3 Correct 35 ms 200 KB Correct
4 Correct 55 ms 300 KB Correct
5 Correct 46 ms 300 KB Correct
6 Runtime error 14 ms 320 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Correct
2 Correct 20 ms 268 KB Correct
3 Correct 35 ms 200 KB Correct
4 Correct 55 ms 300 KB Correct
5 Correct 46 ms 300 KB Correct
6 Runtime error 14 ms 320 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 284 KB Correct
2 Correct 13 ms 200 KB Correct
3 Correct 28 ms 200 KB Correct
4 Correct 59 ms 396 KB Correct
5 Correct 42 ms 276 KB Correct
6 Runtime error 10 ms 428 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 284 KB Correct
2 Correct 13 ms 200 KB Correct
3 Correct 28 ms 200 KB Correct
4 Correct 59 ms 396 KB Correct
5 Correct 42 ms 276 KB Correct
6 Runtime error 10 ms 428 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -