답안 #819548

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819548 2023-08-10T11:41:55 Z AdamGS Minerals (JOI19_minerals) C++17
80 / 100
35 ms 3400 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;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
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>P;
	rep(i, 2*n) {
		P.pb(i);
		swap(P[i], P[rng()%(i+1)]);
	}
	vector<int>X, Y;
	rep(i, 2*n) {
		if(pytaj(P[i])) X.pb(P[i]);
		else Y.pb(P[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:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  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 2 ms 336 KB Output is correct
3 Correct 3 ms 592 KB Output is correct
4 Correct 5 ms 848 KB Output is correct
5 Correct 10 ms 1324 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 2 ms 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 10 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 1104 KB Output is correct
12 Correct 10 ms 1324 KB Output is correct
13 Correct 10 ms 1368 KB Output is correct
14 Correct 12 ms 1352 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 2 ms 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 10 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 1104 KB Output is correct
12 Correct 10 ms 1324 KB Output is correct
13 Correct 10 ms 1368 KB Output is correct
14 Correct 12 ms 1352 KB Output is correct
15 Correct 35 ms 3156 KB Output is correct
16 Correct 29 ms 3272 KB Output is correct
17 Correct 27 ms 3184 KB Output is correct
18 Correct 27 ms 3016 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 2 ms 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 10 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 1104 KB Output is correct
12 Correct 10 ms 1324 KB Output is correct
13 Correct 10 ms 1368 KB Output is correct
14 Correct 12 ms 1352 KB Output is correct
15 Correct 35 ms 3156 KB Output is correct
16 Correct 29 ms 3272 KB Output is correct
17 Correct 27 ms 3184 KB Output is correct
18 Correct 27 ms 3016 KB Output is correct
19 Correct 29 ms 3272 KB Output is correct
20 Correct 35 ms 3368 KB Output is correct
21 Correct 29 ms 3300 KB Output is correct
22 Correct 30 ms 3084 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 2 ms 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 10 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 1104 KB Output is correct
12 Correct 10 ms 1324 KB Output is correct
13 Correct 10 ms 1368 KB Output is correct
14 Correct 12 ms 1352 KB Output is correct
15 Correct 35 ms 3156 KB Output is correct
16 Correct 29 ms 3272 KB Output is correct
17 Correct 27 ms 3184 KB Output is correct
18 Correct 27 ms 3016 KB Output is correct
19 Correct 29 ms 3272 KB Output is correct
20 Correct 35 ms 3368 KB Output is correct
21 Correct 29 ms 3300 KB Output is correct
22 Correct 30 ms 3084 KB Output is correct
23 Correct 35 ms 3300 KB Output is correct
24 Correct 30 ms 3360 KB Output is correct
25 Correct 29 ms 3264 KB Output is correct
26 Correct 30 ms 3248 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 2 ms 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 10 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 1104 KB Output is correct
12 Correct 10 ms 1324 KB Output is correct
13 Correct 10 ms 1368 KB Output is correct
14 Correct 12 ms 1352 KB Output is correct
15 Correct 35 ms 3156 KB Output is correct
16 Correct 29 ms 3272 KB Output is correct
17 Correct 27 ms 3184 KB Output is correct
18 Correct 27 ms 3016 KB Output is correct
19 Correct 29 ms 3272 KB Output is correct
20 Correct 35 ms 3368 KB Output is correct
21 Correct 29 ms 3300 KB Output is correct
22 Correct 30 ms 3084 KB Output is correct
23 Correct 35 ms 3300 KB Output is correct
24 Correct 30 ms 3360 KB Output is correct
25 Correct 29 ms 3264 KB Output is correct
26 Correct 30 ms 3248 KB Output is correct
27 Incorrect 31 ms 3400 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 2 ms 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 10 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 1104 KB Output is correct
12 Correct 10 ms 1324 KB Output is correct
13 Correct 10 ms 1368 KB Output is correct
14 Correct 12 ms 1352 KB Output is correct
15 Correct 35 ms 3156 KB Output is correct
16 Correct 29 ms 3272 KB Output is correct
17 Correct 27 ms 3184 KB Output is correct
18 Correct 27 ms 3016 KB Output is correct
19 Correct 29 ms 3272 KB Output is correct
20 Correct 35 ms 3368 KB Output is correct
21 Correct 29 ms 3300 KB Output is correct
22 Correct 30 ms 3084 KB Output is correct
23 Correct 35 ms 3300 KB Output is correct
24 Correct 30 ms 3360 KB Output is correct
25 Correct 29 ms 3264 KB Output is correct
26 Correct 30 ms 3248 KB Output is correct
27 Incorrect 31 ms 3400 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 2 ms 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 10 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 1104 KB Output is correct
12 Correct 10 ms 1324 KB Output is correct
13 Correct 10 ms 1368 KB Output is correct
14 Correct 12 ms 1352 KB Output is correct
15 Correct 35 ms 3156 KB Output is correct
16 Correct 29 ms 3272 KB Output is correct
17 Correct 27 ms 3184 KB Output is correct
18 Correct 27 ms 3016 KB Output is correct
19 Correct 29 ms 3272 KB Output is correct
20 Correct 35 ms 3368 KB Output is correct
21 Correct 29 ms 3300 KB Output is correct
22 Correct 30 ms 3084 KB Output is correct
23 Correct 35 ms 3300 KB Output is correct
24 Correct 30 ms 3360 KB Output is correct
25 Correct 29 ms 3264 KB Output is correct
26 Correct 30 ms 3248 KB Output is correct
27 Incorrect 31 ms 3400 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -