Submission #901314

# Submission time Handle Problem Language Result Execution time Memory
901314 2024-01-09T10:25:18 Z Darren0724 Minerals (JOI19_minerals) C++17
75 / 100
30 ms 2856 KB
#include "minerals.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
//Query(int)
//Answer(int,int)
int last=0;
int ask(int k){
	int p = Query(k);
	int tmp = p - last;
	last = p;
	return tmp; 
}
void dc(vector<int> &a,vector<int> &b,int t){
	/*for(int i:a){
		cout<<i<<' ';
	}
	cout<<endl;
	for(int i:b){
		cout<<i<<' ';
	}
	cout<<endl;
	cout<<"t: "<<t<<endl;*/
	int n=a.size();
	if(n==1){
		Answer(a[0],b[0]);
		return;
	}
	int m=n/2;
	if(t>0){
		for(int i=m;i<n;i++){
			ask(a[i]);
		}
	}
	else{
		for(int i=0;i<m;i++){
			ask(a[i]);
		}
	}
	vector<int> a1,a2,b1,b2;
	for(int i=0;i<m;i++){
		a1.push_back(a[i]);
	}
	for(int i=m;i<n;i++){
		a2.push_back(a[i]);
	}
	for(int i=0;i<n;i++){
		if(ask(b[i])==0){
			b1.push_back(b[i]);
		}
		else{
			b2.push_back(b[i]);
		}
	}
	if(t==0){
		dc(a1,b1,2);
		dc(b2,a2,1);
	}
	if(t==1){
		dc(a1,b1,2);
		dc(b2,a2,1);
	}
	if(t==2){
		dc(a1,b1,1);
		dc(a2,b2,0);
	}	
}
void Solve(int n) {
	vector<int> a,b;
	for(int i=1;i<=n*2;i++){
		if(ask(i)==0){
			b.push_back(i);
		}
		else{
			a.push_back(i);
		}
	}
	dc(a,b,2);
}
/*
6
1 2
3 4
5 6
8 7
10 9
11 12
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 5 ms 856 KB Output is correct
5 Correct 9 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 9 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 9 ms 1112 KB Output is correct
13 Correct 7 ms 1548 KB Output is correct
14 Correct 7 ms 1484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 9 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 9 ms 1112 KB Output is correct
13 Correct 7 ms 1548 KB Output is correct
14 Correct 7 ms 1484 KB Output is correct
15 Correct 24 ms 2524 KB Output is correct
16 Correct 26 ms 2700 KB Output is correct
17 Correct 22 ms 2724 KB Output is correct
18 Correct 19 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 9 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 9 ms 1112 KB Output is correct
13 Correct 7 ms 1548 KB Output is correct
14 Correct 7 ms 1484 KB Output is correct
15 Correct 24 ms 2524 KB Output is correct
16 Correct 26 ms 2700 KB Output is correct
17 Correct 22 ms 2724 KB Output is correct
18 Correct 19 ms 2392 KB Output is correct
19 Correct 30 ms 2776 KB Output is correct
20 Correct 24 ms 2788 KB Output is correct
21 Correct 21 ms 2816 KB Output is correct
22 Correct 23 ms 2856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 9 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 9 ms 1112 KB Output is correct
13 Correct 7 ms 1548 KB Output is correct
14 Correct 7 ms 1484 KB Output is correct
15 Correct 24 ms 2524 KB Output is correct
16 Correct 26 ms 2700 KB Output is correct
17 Correct 22 ms 2724 KB Output is correct
18 Correct 19 ms 2392 KB Output is correct
19 Correct 30 ms 2776 KB Output is correct
20 Correct 24 ms 2788 KB Output is correct
21 Correct 21 ms 2816 KB Output is correct
22 Correct 23 ms 2856 KB Output is correct
23 Incorrect 25 ms 2800 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 9 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 9 ms 1112 KB Output is correct
13 Correct 7 ms 1548 KB Output is correct
14 Correct 7 ms 1484 KB Output is correct
15 Correct 24 ms 2524 KB Output is correct
16 Correct 26 ms 2700 KB Output is correct
17 Correct 22 ms 2724 KB Output is correct
18 Correct 19 ms 2392 KB Output is correct
19 Correct 30 ms 2776 KB Output is correct
20 Correct 24 ms 2788 KB Output is correct
21 Correct 21 ms 2816 KB Output is correct
22 Correct 23 ms 2856 KB Output is correct
23 Incorrect 25 ms 2800 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 9 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 9 ms 1112 KB Output is correct
13 Correct 7 ms 1548 KB Output is correct
14 Correct 7 ms 1484 KB Output is correct
15 Correct 24 ms 2524 KB Output is correct
16 Correct 26 ms 2700 KB Output is correct
17 Correct 22 ms 2724 KB Output is correct
18 Correct 19 ms 2392 KB Output is correct
19 Correct 30 ms 2776 KB Output is correct
20 Correct 24 ms 2788 KB Output is correct
21 Correct 21 ms 2816 KB Output is correct
22 Correct 23 ms 2856 KB Output is correct
23 Incorrect 25 ms 2800 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 856 KB Output is correct
9 Correct 9 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 6 ms 1112 KB Output is correct
12 Correct 9 ms 1112 KB Output is correct
13 Correct 7 ms 1548 KB Output is correct
14 Correct 7 ms 1484 KB Output is correct
15 Correct 24 ms 2524 KB Output is correct
16 Correct 26 ms 2700 KB Output is correct
17 Correct 22 ms 2724 KB Output is correct
18 Correct 19 ms 2392 KB Output is correct
19 Correct 30 ms 2776 KB Output is correct
20 Correct 24 ms 2788 KB Output is correct
21 Correct 21 ms 2816 KB Output is correct
22 Correct 23 ms 2856 KB Output is correct
23 Incorrect 25 ms 2800 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -