Submission #133223

# Submission time Handle Problem Language Result Execution time Memory
133223 2019-07-20T09:30:36 Z SirCeness Minerals (JOI19_minerals) C++14
40 / 100
30 ms 2724 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() == 1) assert(0);
	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);
		}
		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:28:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < arr.size(); i++){
                   ~~^~~~~~~~~~~~
minerals.cpp:53:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < var.size(); i++){
                   ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 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 380 KB Output is correct
3 Correct 8 ms 636 KB Output is correct
4 Correct 14 ms 760 KB Output is correct
5 Correct 28 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
7 Correct 8 ms 636 KB Output is correct
8 Correct 14 ms 760 KB Output is correct
9 Correct 28 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1016 KB Output is correct
12 Correct 30 ms 1400 KB Output is correct
13 Correct 28 ms 1392 KB Output is correct
14 Correct 25 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
7 Correct 8 ms 636 KB Output is correct
8 Correct 14 ms 760 KB Output is correct
9 Correct 28 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1016 KB Output is correct
12 Correct 30 ms 1400 KB Output is correct
13 Correct 28 ms 1392 KB Output is correct
14 Correct 25 ms 1400 KB Output is correct
15 Incorrect 22 ms 2724 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
7 Correct 8 ms 636 KB Output is correct
8 Correct 14 ms 760 KB Output is correct
9 Correct 28 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1016 KB Output is correct
12 Correct 30 ms 1400 KB Output is correct
13 Correct 28 ms 1392 KB Output is correct
14 Correct 25 ms 1400 KB Output is correct
15 Incorrect 22 ms 2724 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
7 Correct 8 ms 636 KB Output is correct
8 Correct 14 ms 760 KB Output is correct
9 Correct 28 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1016 KB Output is correct
12 Correct 30 ms 1400 KB Output is correct
13 Correct 28 ms 1392 KB Output is correct
14 Correct 25 ms 1400 KB Output is correct
15 Incorrect 22 ms 2724 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
7 Correct 8 ms 636 KB Output is correct
8 Correct 14 ms 760 KB Output is correct
9 Correct 28 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1016 KB Output is correct
12 Correct 30 ms 1400 KB Output is correct
13 Correct 28 ms 1392 KB Output is correct
14 Correct 25 ms 1400 KB Output is correct
15 Incorrect 22 ms 2724 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
7 Correct 8 ms 636 KB Output is correct
8 Correct 14 ms 760 KB Output is correct
9 Correct 28 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1016 KB Output is correct
12 Correct 30 ms 1400 KB Output is correct
13 Correct 28 ms 1392 KB Output is correct
14 Correct 25 ms 1400 KB Output is correct
15 Incorrect 22 ms 2724 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
7 Correct 8 ms 636 KB Output is correct
8 Correct 14 ms 760 KB Output is correct
9 Correct 28 ms 1272 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 20 ms 1016 KB Output is correct
12 Correct 30 ms 1400 KB Output is correct
13 Correct 28 ms 1392 KB Output is correct
14 Correct 25 ms 1400 KB Output is correct
15 Incorrect 22 ms 2724 KB Wrong Answer [4]
16 Halted 0 ms 0 KB -