답안 #615439

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
615439 2022-07-31T09:12:42 Z valerikk Minerals (JOI19_minerals) C++17
6 / 100
31 ms 9868 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
 
mt19937 gen(239);
 
int diff;
 
int query(int x) {
	return diff = Query(x);
}
 
void solve(vector<int> a, vector<int> b) {
	assert(a.size() == b.size());
	if (a.size() == 1) {
		Answer(a[0], b[0]);
		return;
	}
	shuffle(begin(a), end(a), gen);
	shuffle(begin(b), end(b), gen);
	int n = a.size();
	vector<int> al, ar, bl, br;
	int m = n * 1.6;
	m = max(m, 1);
	m = min(m, n - 1);
	for (int i = 0; i < m; ++i) {
		query(a[i]);
		al.push_back(a[i]);
	}
	for (int i = m; i < n; ++i) {
		ar.push_back(a[i]);
	}
	for (int i = 0; i < n; ++i) {
		int old_diff = diff;
		if (query(b[i]) > old_diff) {
			bl.push_back(b[i]);
		} else {
			query(b[i]);
			br.push_back(b[i]);
		}
		if (bl.size() == al.size()) {
			for (int j = i + 1; j < n; ++j) {
				br.push_back(b[j]);
			}
			break;
		}
	}
	solve(bl, al);
	solve(ar, br);
}
 
void Solve(int N) {
	vector<int> a, b;
	for (int i = 1; i <= 2 * N; ++i) {
		int old_diff = diff;
		if (query(i) > old_diff) {
			a.push_back(i);
		} else {
			query(i);
			b.push_back(i);
		}
	}
	solve(a, b);
}	
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 9868 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 31 ms 9868 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 31 ms 9868 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 31 ms 9868 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 31 ms 9868 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 31 ms 9868 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 31 ms 9868 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 31 ms 9868 KB Wrong Answer [2]
6 Halted 0 ms 0 KB -