Submission #710556

# Submission time Handle Problem Language Result Execution time Memory
710556 2023-03-15T11:02:43 Z LittleCube Minerals (JOI19_minerals) C++14
70 / 100
40 ms 3112 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)
	{
		if(bX)
			change(X[0]);
	   	if(bY)
			change(Y[0]);
		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);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory 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 7 ms 848 KB Output is correct
5 Correct 14 ms 1324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 7 ms 848 KB Output is correct
9 Correct 14 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1048 KB Output is correct
12 Correct 11 ms 1312 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 7 ms 848 KB Output is correct
9 Correct 14 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1048 KB Output is correct
12 Correct 11 ms 1312 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1388 KB Output is correct
15 Correct 40 ms 3028 KB Output is correct
16 Correct 35 ms 3112 KB Output is correct
17 Correct 29 ms 3012 KB Output is correct
18 Correct 32 ms 2892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 7 ms 848 KB Output is correct
9 Correct 14 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1048 KB Output is correct
12 Correct 11 ms 1312 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1388 KB Output is correct
15 Correct 40 ms 3028 KB Output is correct
16 Correct 35 ms 3112 KB Output is correct
17 Correct 29 ms 3012 KB Output is correct
18 Correct 32 ms 2892 KB Output is correct
19 Incorrect 34 ms 3084 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 7 ms 848 KB Output is correct
9 Correct 14 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1048 KB Output is correct
12 Correct 11 ms 1312 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1388 KB Output is correct
15 Correct 40 ms 3028 KB Output is correct
16 Correct 35 ms 3112 KB Output is correct
17 Correct 29 ms 3012 KB Output is correct
18 Correct 32 ms 2892 KB Output is correct
19 Incorrect 34 ms 3084 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 7 ms 848 KB Output is correct
9 Correct 14 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1048 KB Output is correct
12 Correct 11 ms 1312 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1388 KB Output is correct
15 Correct 40 ms 3028 KB Output is correct
16 Correct 35 ms 3112 KB Output is correct
17 Correct 29 ms 3012 KB Output is correct
18 Correct 32 ms 2892 KB Output is correct
19 Incorrect 34 ms 3084 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 7 ms 848 KB Output is correct
9 Correct 14 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1048 KB Output is correct
12 Correct 11 ms 1312 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1388 KB Output is correct
15 Correct 40 ms 3028 KB Output is correct
16 Correct 35 ms 3112 KB Output is correct
17 Correct 29 ms 3012 KB Output is correct
18 Correct 32 ms 2892 KB Output is correct
19 Incorrect 34 ms 3084 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 7 ms 848 KB Output is correct
9 Correct 14 ms 1324 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 1048 KB Output is correct
12 Correct 11 ms 1312 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1388 KB Output is correct
15 Correct 40 ms 3028 KB Output is correct
16 Correct 35 ms 3112 KB Output is correct
17 Correct 29 ms 3012 KB Output is correct
18 Correct 32 ms 2892 KB Output is correct
19 Incorrect 34 ms 3084 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -