Submission #133219

# Submission time Handle Problem Language Result Execution time Memory
133219 2019-07-20T09:27:23 Z SirCeness Minerals (JOI19_minerals) C++14
6 / 100
1000 ms 1144 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> in, 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> 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);
					in[arr[i]] = 1;
					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);
				in[arr[i]] = 1;	
				//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 < n; i++){
			if (in[i]) Query(i+1);
			in[i] = 0;
		}
		bol(arr1);
		bol(arr2);
	}
}

void Solve(int N){
	n = 2*N;
	in.reset();
	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++){
                   ~~^~~~~~~~~~~~
# 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 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 23 ms 376 KB Output is correct
3 Correct 82 ms 552 KB Output is correct
4 Correct 313 ms 696 KB Output is correct
5 Execution timed out 1077 ms 1144 KB Time limit exceeded
# 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 2 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 23 ms 376 KB Output is correct
7 Correct 82 ms 552 KB Output is correct
8 Correct 313 ms 696 KB Output is correct
9 Execution timed out 1077 ms 1144 KB Time limit exceeded
# 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 2 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 23 ms 376 KB Output is correct
7 Correct 82 ms 552 KB Output is correct
8 Correct 313 ms 696 KB Output is correct
9 Execution timed out 1077 ms 1144 KB Time limit exceeded
# 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 2 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 23 ms 376 KB Output is correct
7 Correct 82 ms 552 KB Output is correct
8 Correct 313 ms 696 KB Output is correct
9 Execution timed out 1077 ms 1144 KB Time limit exceeded
# 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 2 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 23 ms 376 KB Output is correct
7 Correct 82 ms 552 KB Output is correct
8 Correct 313 ms 696 KB Output is correct
9 Execution timed out 1077 ms 1144 KB Time limit exceeded
# 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 2 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 23 ms 376 KB Output is correct
7 Correct 82 ms 552 KB Output is correct
8 Correct 313 ms 696 KB Output is correct
9 Execution timed out 1077 ms 1144 KB Time limit exceeded
# 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 2 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 23 ms 376 KB Output is correct
7 Correct 82 ms 552 KB Output is correct
8 Correct 313 ms 696 KB Output is correct
9 Execution timed out 1077 ms 1144 KB Time limit exceeded
# 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 2 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 23 ms 376 KB Output is correct
7 Correct 82 ms 552 KB Output is correct
8 Correct 313 ms 696 KB Output is correct
9 Execution timed out 1077 ms 1144 KB Time limit exceeded