Submission #973688

# Submission time Handle Problem Language Result Execution time Memory
973688 2024-05-02T09:39:02 Z siewjh Minerals (JOI19_minerals) C++17
0 / 100
142 ms 262144 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

int lans = 0;
int qry(int x){ 
	int ans = Query(x);
	swap(lans, ans);
	return lans != ans;
}

void dnc(vector<int> &v1, vector<int> &v2, bool lin){
	int sz = v1.size(), mid = min(1, (int)(sz * 0.4));
	if (sz == 1){
		Answer(v1[0], v2[0]);
		return;
	}
	vector<int> l1, l2, r1, r2;
	for (int i = 0; i < mid; i++){
		qry(v1[i]); l1.push_back(v1[i]);
	}
	for (int i = mid; i < sz; i++) r1.push_back(v1[i]);
	for (int i = 0; i < sz; i++){
		if (l2.size() == l1.size()) r2.push_back(v2[i]);
		else if (r2.size() == r1.size()) l2.push_back(v2[i]);
		else{
			if (lin != qry(v2[i])) l2.push_back(v2[i]);
			else r2.push_back(v2[i]);
		}
	}
	dnc(l1, l2, !lin); dnc(r1, r2, lin);
}

void Solve(int N){
	vector<int> v1, v2;
	for (int i = 1; i <= 2 * N; i++){
		if (qry(i)) v1.push_back(i);
		else v2.push_back(i);
	}
	dnc(v1, v2, 0);
}
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 139 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 142 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -