Submission #156822

# Submission time Handle Problem Language Result Execution time Memory
156822 2019-10-07T15:20:41 Z popovicirobert Minerals (JOI19_minerals) C++14
6 / 100
19 ms 632 KB
#include "minerals.h"
#include <bits/stdc++.h>

using namespace std;

void Solve(int n) {
	vector <int> sol(2 * n);
	vector <bool> in(2 * n);
	int i, ans = 0;
  	for(int bit = 15; bit >= 0; bit--) {
		if((1 << bit) >= 2 * n) continue;
		vector <bool> vis(2 * n);
		for(i = 0; i < 2 * n; i++) {
			if(i & (1 << bit)) {
				if(in[i]) continue;
				int cur = Query(i + 1);
				if(cur == ans) {
					vis[i] = 1;
					sol[i] ^= (1 << bit);
				}
				ans = cur;
				in[i] = 1;
			}
		}
		for(i = 0; i < 2 * n; i++) {
			if(vis[i]) continue;
			int cur = Query(i + 1);
			if(cur == ans) {
				sol[i] += (1 << bit);
			}
			Query(i + 1);
		}
		for(i = 0; i < 2 * n; i++) {
			if(bit == 0) continue;
			if(i & (1 << bit)) {
				if(i & (1 << (bit - 1))) continue;
				ans = Query(i + 1);
				in[i] = 0;
			}
		}
	}
	
	vector <bool> vis(2 * n);
	for(i = 0; i < 2 * n; i++) {
		if(vis[i] == 0) {
			vis[i] = vis[sol[i]] = 1;
			Answer(i + 1, sol[i] + 1);
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 11 ms 632 KB Output is correct
5 Incorrect 19 ms 632 KB Wrong Answer [2]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 11 ms 632 KB Output is correct
9 Incorrect 19 ms 632 KB Wrong Answer [2]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 11 ms 632 KB Output is correct
9 Incorrect 19 ms 632 KB Wrong Answer [2]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 11 ms 632 KB Output is correct
9 Incorrect 19 ms 632 KB Wrong Answer [2]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 11 ms 632 KB Output is correct
9 Incorrect 19 ms 632 KB Wrong Answer [2]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 11 ms 632 KB Output is correct
9 Incorrect 19 ms 632 KB Wrong Answer [2]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 11 ms 632 KB Output is correct
9 Incorrect 19 ms 632 KB Wrong Answer [2]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 11 ms 632 KB Output is correct
9 Incorrect 19 ms 632 KB Wrong Answer [2]