답안 #710558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710558 2023-03-15T11:04:07 Z LittleCube Minerals (JOI19_minerals) C++14
80 / 100
48 ms 3292 KB
#include "minerals.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
using namespace std;

int pre, cur;

bool change(int x)
{
	// cerr << "change " << x << '\n';
	cur = Query(x);
	swap(pre, cur);
	return pre != cur;
}

void solve(vector<int> X, vector<int> Y, bool bX, bool bY)
{	
	if(X.size() == 1)
	{
		Answer(X[0], Y[0]);
		return;
	}
	int N = X.size(), mid = N / 2;

	vector<int> lX(X.begin(), X.begin() + mid), rX(X.begin() + mid, X.end()), lY, rY;

	if(bX)
		for(int i = mid; i < N; i++)
			change(X[i]);
	else
		for(int i = 0; i < mid; i++)
			change(X[i]);

	for(int i : Y)
		if(change(i))
			rY.emplace_back(i);
		else 
			lY.emplace_back(i);

	solve(lX, lY, 1, !bY);
	solve(rX, rY, 0, !bY);

}

void Solve(int N)
{
	pre = cur = 0;
	vector<int> X, Y;
	for(int i = 1; i <= 2 * N; i++)
	{
		if(change(i))
			X.emplace_back(i);
		else
			Y.emplace_back(i);
	}
	solve(X, Y, 1, 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 6 ms 844 KB Output is correct
5 Correct 12 ms 1232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 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 6 ms 844 KB Output is correct
9 Correct 12 ms 1232 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 13 ms 1360 KB Output is correct
13 Correct 16 ms 1388 KB Output is correct
14 Correct 15 ms 1232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 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 6 ms 844 KB Output is correct
9 Correct 12 ms 1232 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 13 ms 1360 KB Output is correct
13 Correct 16 ms 1388 KB Output is correct
14 Correct 15 ms 1232 KB Output is correct
15 Correct 37 ms 3080 KB Output is correct
16 Correct 44 ms 3112 KB Output is correct
17 Correct 35 ms 3084 KB Output is correct
18 Correct 33 ms 2948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 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 6 ms 844 KB Output is correct
9 Correct 12 ms 1232 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 13 ms 1360 KB Output is correct
13 Correct 16 ms 1388 KB Output is correct
14 Correct 15 ms 1232 KB Output is correct
15 Correct 37 ms 3080 KB Output is correct
16 Correct 44 ms 3112 KB Output is correct
17 Correct 35 ms 3084 KB Output is correct
18 Correct 33 ms 2948 KB Output is correct
19 Correct 39 ms 3160 KB Output is correct
20 Correct 37 ms 3180 KB Output is correct
21 Correct 44 ms 3120 KB Output is correct
22 Correct 38 ms 2984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 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 6 ms 844 KB Output is correct
9 Correct 12 ms 1232 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 13 ms 1360 KB Output is correct
13 Correct 16 ms 1388 KB Output is correct
14 Correct 15 ms 1232 KB Output is correct
15 Correct 37 ms 3080 KB Output is correct
16 Correct 44 ms 3112 KB Output is correct
17 Correct 35 ms 3084 KB Output is correct
18 Correct 33 ms 2948 KB Output is correct
19 Correct 39 ms 3160 KB Output is correct
20 Correct 37 ms 3180 KB Output is correct
21 Correct 44 ms 3120 KB Output is correct
22 Correct 38 ms 2984 KB Output is correct
23 Correct 35 ms 3220 KB Output is correct
24 Correct 41 ms 3228 KB Output is correct
25 Correct 31 ms 3184 KB Output is correct
26 Correct 35 ms 3004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 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 6 ms 844 KB Output is correct
9 Correct 12 ms 1232 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 13 ms 1360 KB Output is correct
13 Correct 16 ms 1388 KB Output is correct
14 Correct 15 ms 1232 KB Output is correct
15 Correct 37 ms 3080 KB Output is correct
16 Correct 44 ms 3112 KB Output is correct
17 Correct 35 ms 3084 KB Output is correct
18 Correct 33 ms 2948 KB Output is correct
19 Correct 39 ms 3160 KB Output is correct
20 Correct 37 ms 3180 KB Output is correct
21 Correct 44 ms 3120 KB Output is correct
22 Correct 38 ms 2984 KB Output is correct
23 Correct 35 ms 3220 KB Output is correct
24 Correct 41 ms 3228 KB Output is correct
25 Correct 31 ms 3184 KB Output is correct
26 Correct 35 ms 3004 KB Output is correct
27 Incorrect 48 ms 3292 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 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 6 ms 844 KB Output is correct
9 Correct 12 ms 1232 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 13 ms 1360 KB Output is correct
13 Correct 16 ms 1388 KB Output is correct
14 Correct 15 ms 1232 KB Output is correct
15 Correct 37 ms 3080 KB Output is correct
16 Correct 44 ms 3112 KB Output is correct
17 Correct 35 ms 3084 KB Output is correct
18 Correct 33 ms 2948 KB Output is correct
19 Correct 39 ms 3160 KB Output is correct
20 Correct 37 ms 3180 KB Output is correct
21 Correct 44 ms 3120 KB Output is correct
22 Correct 38 ms 2984 KB Output is correct
23 Correct 35 ms 3220 KB Output is correct
24 Correct 41 ms 3228 KB Output is correct
25 Correct 31 ms 3184 KB Output is correct
26 Correct 35 ms 3004 KB Output is correct
27 Incorrect 48 ms 3292 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 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 6 ms 844 KB Output is correct
9 Correct 12 ms 1232 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 13 ms 1360 KB Output is correct
13 Correct 16 ms 1388 KB Output is correct
14 Correct 15 ms 1232 KB Output is correct
15 Correct 37 ms 3080 KB Output is correct
16 Correct 44 ms 3112 KB Output is correct
17 Correct 35 ms 3084 KB Output is correct
18 Correct 33 ms 2948 KB Output is correct
19 Correct 39 ms 3160 KB Output is correct
20 Correct 37 ms 3180 KB Output is correct
21 Correct 44 ms 3120 KB Output is correct
22 Correct 38 ms 2984 KB Output is correct
23 Correct 35 ms 3220 KB Output is correct
24 Correct 41 ms 3228 KB Output is correct
25 Correct 31 ms 3184 KB Output is correct
26 Correct 35 ms 3004 KB Output is correct
27 Incorrect 48 ms 3292 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -