답안 #819524

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819524 2023-08-10T11:31:25 Z AdamGS Minerals (JOI19_minerals) C++17
80 / 100
29 ms 3052 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);
	}
	dc(X, Y);
}

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 2 ms 336 KB Output is correct
3 Correct 3 ms 464 KB Output is correct
4 Correct 5 ms 720 KB Output is correct
5 Correct 9 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 2 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 976 KB Output is correct
12 Correct 9 ms 1232 KB Output is correct
13 Correct 7 ms 1252 KB Output is correct
14 Correct 7 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 2 ms 336 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 976 KB Output is correct
12 Correct 9 ms 1232 KB Output is correct
13 Correct 7 ms 1252 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 24 ms 2868 KB Output is correct
16 Correct 27 ms 2896 KB Output is correct
17 Correct 24 ms 2724 KB Output is correct
18 Correct 18 ms 2660 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 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 976 KB Output is correct
12 Correct 9 ms 1232 KB Output is correct
13 Correct 7 ms 1252 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 24 ms 2868 KB Output is correct
16 Correct 27 ms 2896 KB Output is correct
17 Correct 24 ms 2724 KB Output is correct
18 Correct 18 ms 2660 KB Output is correct
19 Correct 29 ms 2940 KB Output is correct
20 Correct 24 ms 2940 KB Output is correct
21 Correct 19 ms 2848 KB Output is correct
22 Correct 19 ms 2628 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 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 976 KB Output is correct
12 Correct 9 ms 1232 KB Output is correct
13 Correct 7 ms 1252 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 24 ms 2868 KB Output is correct
16 Correct 27 ms 2896 KB Output is correct
17 Correct 24 ms 2724 KB Output is correct
18 Correct 18 ms 2660 KB Output is correct
19 Correct 29 ms 2940 KB Output is correct
20 Correct 24 ms 2940 KB Output is correct
21 Correct 19 ms 2848 KB Output is correct
22 Correct 19 ms 2628 KB Output is correct
23 Correct 29 ms 2896 KB Output is correct
24 Correct 25 ms 2892 KB Output is correct
25 Correct 22 ms 2868 KB Output is correct
26 Correct 20 ms 2748 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 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 976 KB Output is correct
12 Correct 9 ms 1232 KB Output is correct
13 Correct 7 ms 1252 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 24 ms 2868 KB Output is correct
16 Correct 27 ms 2896 KB Output is correct
17 Correct 24 ms 2724 KB Output is correct
18 Correct 18 ms 2660 KB Output is correct
19 Correct 29 ms 2940 KB Output is correct
20 Correct 24 ms 2940 KB Output is correct
21 Correct 19 ms 2848 KB Output is correct
22 Correct 19 ms 2628 KB Output is correct
23 Correct 29 ms 2896 KB Output is correct
24 Correct 25 ms 2892 KB Output is correct
25 Correct 22 ms 2868 KB Output is correct
26 Correct 20 ms 2748 KB Output is correct
27 Incorrect 25 ms 3052 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 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 976 KB Output is correct
12 Correct 9 ms 1232 KB Output is correct
13 Correct 7 ms 1252 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 24 ms 2868 KB Output is correct
16 Correct 27 ms 2896 KB Output is correct
17 Correct 24 ms 2724 KB Output is correct
18 Correct 18 ms 2660 KB Output is correct
19 Correct 29 ms 2940 KB Output is correct
20 Correct 24 ms 2940 KB Output is correct
21 Correct 19 ms 2848 KB Output is correct
22 Correct 19 ms 2628 KB Output is correct
23 Correct 29 ms 2896 KB Output is correct
24 Correct 25 ms 2892 KB Output is correct
25 Correct 22 ms 2868 KB Output is correct
26 Correct 20 ms 2748 KB Output is correct
27 Incorrect 25 ms 3052 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 464 KB Output is correct
8 Correct 5 ms 720 KB Output is correct
9 Correct 9 ms 1104 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 976 KB Output is correct
12 Correct 9 ms 1232 KB Output is correct
13 Correct 7 ms 1252 KB Output is correct
14 Correct 7 ms 1104 KB Output is correct
15 Correct 24 ms 2868 KB Output is correct
16 Correct 27 ms 2896 KB Output is correct
17 Correct 24 ms 2724 KB Output is correct
18 Correct 18 ms 2660 KB Output is correct
19 Correct 29 ms 2940 KB Output is correct
20 Correct 24 ms 2940 KB Output is correct
21 Correct 19 ms 2848 KB Output is correct
22 Correct 19 ms 2628 KB Output is correct
23 Correct 29 ms 2896 KB Output is correct
24 Correct 25 ms 2892 KB Output is correct
25 Correct 22 ms 2868 KB Output is correct
26 Correct 20 ms 2748 KB Output is correct
27 Incorrect 25 ms 3052 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -