답안 #133224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
133224 2019-07-20T09:34:36 Z SirCeness Minerals (JOI19_minerals) C++14
40 / 100
30 ms 2676 KB
#include "minerals.h"
#include <bits/stdc++.h>

using namespace std;
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define bas(x) #x << ": " << x << " "
#define prarr(x, n) cout << #x << ": "; for (int qsd = 0; qsd < n; qsd++) cout << x[qsd] << " "; cout << endl;
#define prarrv(x) cout << #x << ": "; for (int qsd = 0; qsd < (int)x.size(); qsd++) cout << x[qsd] << " "; cout << endl;
#define inside sl<=l&&r<=sr
#define outside sr<l||r<sl

typedef long long ll;

bitset<50000> son;
int n;

void bol(vector<int>& arr){
	//prarrv(arr);
	if (arr.size() == 2) Answer(arr[0]+1, arr[1]+1);
	else {
		int prt = 1;
		int last = 0;
		vector<int> var;
		vector<int> arr1, arr2;
		for (int i = 0; i < arr.size(); i++){
			//cout << "i: " << arr[i] << endl;
			if (son[arr[i]] == 0){
				//cout << "son: 0" << endl;
				if (prt){
					//cout << "ekle: 1" << endl;
					last = Query(arr[i]+1);
					var.pb(arr[i]);
					arr1.pb(arr[i]);
					
				} else {
					//cout << "ekle: 2" << endl;
					arr2.pb(arr[i]);
				}
				prt = !prt;
			} else {
				//cout << "son: 1" << endl;
				int ans = Query(arr[i]+1);
				var.pb(arr[i]);	
				//cout << bas(ans) << bas(last) << endl;
				if (ans == last) arr1.pb(arr[i]);
				else arr2.pb(arr[i]);
				last = ans;
			}	
		}
		for (int i = 0; i < var.size(); i++){
			Query(var[i]+1);
		}
		assert(arr1.size() + arr2.size() == arr.size());
		bol(arr1);
		bol(arr2);
	}
}

void Solve(int N){
	n = 2*N;
	int last = 0;
	for (int i = 0; i < n; i++){
		int ans = Query(i+1);
		son[i] = (ans == last);
		last = ans;
	}
	for (int i = 0; i < n; i++) Query(i+1);
	
	vector<int> nums(n);
	for (int i = 0; i < n; i++) nums[i] = i;
	bol(nums);
	
}

Compilation message

minerals.cpp: In function 'void bol(std::vector<int>&)':
minerals.cpp:27:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < arr.size(); i++){
                   ~~^~~~~~~~~~~~
minerals.cpp:52:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < var.size(); i++){
                   ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
4 Correct 15 ms 928 KB Output is correct
5 Correct 27 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 8 ms 504 KB Output is correct
8 Correct 15 ms 928 KB Output is correct
9 Correct 27 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1028 KB Output is correct
12 Correct 30 ms 1276 KB Output is correct
13 Correct 27 ms 1272 KB Output is correct
14 Correct 25 ms 1396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 8 ms 504 KB Output is correct
8 Correct 15 ms 928 KB Output is correct
9 Correct 27 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1028 KB Output is correct
12 Correct 30 ms 1276 KB Output is correct
13 Correct 27 ms 1272 KB Output is correct
14 Correct 25 ms 1396 KB Output is correct
15 Incorrect 22 ms 2676 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 8 ms 504 KB Output is correct
8 Correct 15 ms 928 KB Output is correct
9 Correct 27 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1028 KB Output is correct
12 Correct 30 ms 1276 KB Output is correct
13 Correct 27 ms 1272 KB Output is correct
14 Correct 25 ms 1396 KB Output is correct
15 Incorrect 22 ms 2676 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 8 ms 504 KB Output is correct
8 Correct 15 ms 928 KB Output is correct
9 Correct 27 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1028 KB Output is correct
12 Correct 30 ms 1276 KB Output is correct
13 Correct 27 ms 1272 KB Output is correct
14 Correct 25 ms 1396 KB Output is correct
15 Incorrect 22 ms 2676 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 8 ms 504 KB Output is correct
8 Correct 15 ms 928 KB Output is correct
9 Correct 27 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1028 KB Output is correct
12 Correct 30 ms 1276 KB Output is correct
13 Correct 27 ms 1272 KB Output is correct
14 Correct 25 ms 1396 KB Output is correct
15 Incorrect 22 ms 2676 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 8 ms 504 KB Output is correct
8 Correct 15 ms 928 KB Output is correct
9 Correct 27 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1028 KB Output is correct
12 Correct 30 ms 1276 KB Output is correct
13 Correct 27 ms 1272 KB Output is correct
14 Correct 25 ms 1396 KB Output is correct
15 Incorrect 22 ms 2676 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 8 ms 504 KB Output is correct
8 Correct 15 ms 928 KB Output is correct
9 Correct 27 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1028 KB Output is correct
12 Correct 30 ms 1276 KB Output is correct
13 Correct 27 ms 1272 KB Output is correct
14 Correct 25 ms 1396 KB Output is correct
15 Incorrect 22 ms 2676 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -