Submission #710026

# Submission time Handle Problem Language Result Execution time Memory
710026 2023-03-15T03:53:40 Z LittleCube Minerals (JOI19_minerals) C++14
40 / 100
30 ms 3092 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 built)
{
	if(X.size() == 1)
	{
		if(built)
			change(X[0]), 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(built)
	{
		for(int i = mid; i < N; i++)
			change(X[i]);
		for(int i : Y)
			if(change(i))
				rY.emplace_back(i);
			else 
				lY.emplace_back(i);
		for(int i : lY)
			change(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);
		for(int i : rY)
			change(i);
	}
	solve(lX, lY, 1);
	solve(rX, rY, 0);

}

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);
}
# 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 1 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 448 KB Output is correct
3 Correct 4 ms 464 KB Output is correct
4 Correct 9 ms 848 KB Output is correct
5 Correct 16 ms 1312 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 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 848 KB Output is correct
9 Correct 16 ms 1312 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 976 KB Output is correct
12 Correct 17 ms 1396 KB Output is correct
13 Correct 14 ms 1360 KB Output is correct
14 Correct 11 ms 1232 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 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 848 KB Output is correct
9 Correct 16 ms 1312 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 976 KB Output is correct
12 Correct 17 ms 1396 KB Output is correct
13 Correct 14 ms 1360 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Incorrect 30 ms 3092 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 848 KB Output is correct
9 Correct 16 ms 1312 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 976 KB Output is correct
12 Correct 17 ms 1396 KB Output is correct
13 Correct 14 ms 1360 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Incorrect 30 ms 3092 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 848 KB Output is correct
9 Correct 16 ms 1312 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 976 KB Output is correct
12 Correct 17 ms 1396 KB Output is correct
13 Correct 14 ms 1360 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Incorrect 30 ms 3092 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 848 KB Output is correct
9 Correct 16 ms 1312 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 976 KB Output is correct
12 Correct 17 ms 1396 KB Output is correct
13 Correct 14 ms 1360 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Incorrect 30 ms 3092 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 848 KB Output is correct
9 Correct 16 ms 1312 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 976 KB Output is correct
12 Correct 17 ms 1396 KB Output is correct
13 Correct 14 ms 1360 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Incorrect 30 ms 3092 KB Wrong Answer [2]
16 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 1 ms 208 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 848 KB Output is correct
9 Correct 16 ms 1312 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 11 ms 976 KB Output is correct
12 Correct 17 ms 1396 KB Output is correct
13 Correct 14 ms 1360 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Incorrect 30 ms 3092 KB Wrong Answer [2]
16 Halted 0 ms 0 KB -