답안 #819546

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819546 2023-08-10T11:40:44 Z AdamGS Minerals (JOI19_minerals) C++17
80 / 100
32 ms 3096 KB
#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#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=5e4+7;
int czy[2*LIM], lst=-1;
bool pytaj(int x) {
	czy[x]^=1;
	int a=Query(x+1);
	swap(a, lst);
	return a!=lst;
}
void dc(vector<int>&X, vector<int>&Y) {
	if(X.size()==1) {
		Answer(X[0]+1, Y[0]+1);
		return;
	}
	vector<int>AX, AY, BX, BY;
	int mid=X.size()/2;
	rep(i, mid) {
		pytaj(X[i]);
		AX.pb(X[i]);
	}
	for(int i=mid; i<X.size(); ++i) BX.pb(X[i]);
	for(auto i : Y) {
		if(czy[X[0]]) {
			if(pytaj(i)) BY.pb(i);
			else AY.pb(i);
		} else {
			if(pytaj(i)) AY.pb(i);
			else BY.pb(i);
		}
	}
	dc(AX, AY);
	dc(BX, BY);
}
void Solve(int n) {
	vector<int>X, Y;
	rep(i, 2*n) {
		if(pytaj(i)) X.pb(i);
		else Y.pb(i);
		if(X.size()==Y.size()) {
			dc(X, Y);
			X.clear();
			Y.clear();
		}
	}
}

Compilation message

minerals.cpp: In function 'void dc(std::vector<int>&, std::vector<int>&)':
minerals.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i=mid; i<X.size(); ++i) BX.pb(X[i]);
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 3 ms 464 KB Output is correct
4 Correct 6 ms 720 KB Output is correct
5 Correct 11 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 6 ms 720 KB Output is correct
9 Correct 11 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1024 KB Output is correct
12 Correct 9 ms 1188 KB Output is correct
13 Correct 3 ms 848 KB Output is correct
14 Correct 8 ms 1132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 6 ms 720 KB Output is correct
9 Correct 11 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1024 KB Output is correct
12 Correct 9 ms 1188 KB Output is correct
13 Correct 3 ms 848 KB Output is correct
14 Correct 8 ms 1132 KB Output is correct
15 Correct 32 ms 3024 KB Output is correct
16 Correct 25 ms 2900 KB Output is correct
17 Correct 7 ms 1744 KB Output is correct
18 Correct 19 ms 2564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 6 ms 720 KB Output is correct
9 Correct 11 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1024 KB Output is correct
12 Correct 9 ms 1188 KB Output is correct
13 Correct 3 ms 848 KB Output is correct
14 Correct 8 ms 1132 KB Output is correct
15 Correct 32 ms 3024 KB Output is correct
16 Correct 25 ms 2900 KB Output is correct
17 Correct 7 ms 1744 KB Output is correct
18 Correct 19 ms 2564 KB Output is correct
19 Correct 28 ms 2984 KB Output is correct
20 Correct 24 ms 2972 KB Output is correct
21 Correct 7 ms 1744 KB Output is correct
22 Correct 19 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 6 ms 720 KB Output is correct
9 Correct 11 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1024 KB Output is correct
12 Correct 9 ms 1188 KB Output is correct
13 Correct 3 ms 848 KB Output is correct
14 Correct 8 ms 1132 KB Output is correct
15 Correct 32 ms 3024 KB Output is correct
16 Correct 25 ms 2900 KB Output is correct
17 Correct 7 ms 1744 KB Output is correct
18 Correct 19 ms 2564 KB Output is correct
19 Correct 28 ms 2984 KB Output is correct
20 Correct 24 ms 2972 KB Output is correct
21 Correct 7 ms 1744 KB Output is correct
22 Correct 19 ms 2644 KB Output is correct
23 Correct 32 ms 2896 KB Output is correct
24 Correct 31 ms 2996 KB Output is correct
25 Correct 11 ms 1856 KB Output is correct
26 Correct 20 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 6 ms 720 KB Output is correct
9 Correct 11 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1024 KB Output is correct
12 Correct 9 ms 1188 KB Output is correct
13 Correct 3 ms 848 KB Output is correct
14 Correct 8 ms 1132 KB Output is correct
15 Correct 32 ms 3024 KB Output is correct
16 Correct 25 ms 2900 KB Output is correct
17 Correct 7 ms 1744 KB Output is correct
18 Correct 19 ms 2564 KB Output is correct
19 Correct 28 ms 2984 KB Output is correct
20 Correct 24 ms 2972 KB Output is correct
21 Correct 7 ms 1744 KB Output is correct
22 Correct 19 ms 2644 KB Output is correct
23 Correct 32 ms 2896 KB Output is correct
24 Correct 31 ms 2996 KB Output is correct
25 Correct 11 ms 1856 KB Output is correct
26 Correct 20 ms 2772 KB Output is correct
27 Incorrect 25 ms 3096 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 6 ms 720 KB Output is correct
9 Correct 11 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1024 KB Output is correct
12 Correct 9 ms 1188 KB Output is correct
13 Correct 3 ms 848 KB Output is correct
14 Correct 8 ms 1132 KB Output is correct
15 Correct 32 ms 3024 KB Output is correct
16 Correct 25 ms 2900 KB Output is correct
17 Correct 7 ms 1744 KB Output is correct
18 Correct 19 ms 2564 KB Output is correct
19 Correct 28 ms 2984 KB Output is correct
20 Correct 24 ms 2972 KB Output is correct
21 Correct 7 ms 1744 KB Output is correct
22 Correct 19 ms 2644 KB Output is correct
23 Correct 32 ms 2896 KB Output is correct
24 Correct 31 ms 2996 KB Output is correct
25 Correct 11 ms 1856 KB Output is correct
26 Correct 20 ms 2772 KB Output is correct
27 Incorrect 25 ms 3096 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 6 ms 720 KB Output is correct
9 Correct 11 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1024 KB Output is correct
12 Correct 9 ms 1188 KB Output is correct
13 Correct 3 ms 848 KB Output is correct
14 Correct 8 ms 1132 KB Output is correct
15 Correct 32 ms 3024 KB Output is correct
16 Correct 25 ms 2900 KB Output is correct
17 Correct 7 ms 1744 KB Output is correct
18 Correct 19 ms 2564 KB Output is correct
19 Correct 28 ms 2984 KB Output is correct
20 Correct 24 ms 2972 KB Output is correct
21 Correct 7 ms 1744 KB Output is correct
22 Correct 19 ms 2644 KB Output is correct
23 Correct 32 ms 2896 KB Output is correct
24 Correct 31 ms 2996 KB Output is correct
25 Correct 11 ms 1856 KB Output is correct
26 Correct 20 ms 2772 KB Output is correct
27 Incorrect 25 ms 3096 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -