Submission #901318

# Submission time Handle Problem Language Result Execution time Memory
901318 2024-01-09T10:30:53 Z Darren0724 Minerals (JOI19_minerals) C++17
75 / 100
24 ms 3232 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){
	int n=a.size();
	if(n==1){
		Answer(a[0],b[0]);
		return;
	}
	int r=__lg(n-1);
	int m=1<<r;
	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 1 ms 340 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 4 ms 600 KB Output is correct
5 Correct 8 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 4 ms 600 KB Output is correct
9 Correct 8 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1028 KB Output is correct
12 Correct 12 ms 1368 KB Output is correct
13 Correct 7 ms 1060 KB Output is correct
14 Correct 7 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 4 ms 600 KB Output is correct
9 Correct 8 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1028 KB Output is correct
12 Correct 12 ms 1368 KB Output is correct
13 Correct 7 ms 1060 KB Output is correct
14 Correct 7 ms 1276 KB Output is correct
15 Correct 24 ms 2648 KB Output is correct
16 Correct 23 ms 2528 KB Output is correct
17 Correct 18 ms 2520 KB Output is correct
18 Correct 23 ms 3232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 4 ms 600 KB Output is correct
9 Correct 8 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1028 KB Output is correct
12 Correct 12 ms 1368 KB Output is correct
13 Correct 7 ms 1060 KB Output is correct
14 Correct 7 ms 1276 KB Output is correct
15 Correct 24 ms 2648 KB Output is correct
16 Correct 23 ms 2528 KB Output is correct
17 Correct 18 ms 2520 KB Output is correct
18 Correct 23 ms 3232 KB Output is correct
19 Correct 23 ms 2792 KB Output is correct
20 Correct 23 ms 2788 KB Output is correct
21 Correct 18 ms 3044 KB Output is correct
22 Correct 22 ms 2472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 4 ms 600 KB Output is correct
9 Correct 8 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1028 KB Output is correct
12 Correct 12 ms 1368 KB Output is correct
13 Correct 7 ms 1060 KB Output is correct
14 Correct 7 ms 1276 KB Output is correct
15 Correct 24 ms 2648 KB Output is correct
16 Correct 23 ms 2528 KB Output is correct
17 Correct 18 ms 2520 KB Output is correct
18 Correct 23 ms 3232 KB Output is correct
19 Correct 23 ms 2792 KB Output is correct
20 Correct 23 ms 2788 KB Output is correct
21 Correct 18 ms 3044 KB Output is correct
22 Correct 22 ms 2472 KB Output is correct
23 Incorrect 23 ms 2796 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 4 ms 600 KB Output is correct
9 Correct 8 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1028 KB Output is correct
12 Correct 12 ms 1368 KB Output is correct
13 Correct 7 ms 1060 KB Output is correct
14 Correct 7 ms 1276 KB Output is correct
15 Correct 24 ms 2648 KB Output is correct
16 Correct 23 ms 2528 KB Output is correct
17 Correct 18 ms 2520 KB Output is correct
18 Correct 23 ms 3232 KB Output is correct
19 Correct 23 ms 2792 KB Output is correct
20 Correct 23 ms 2788 KB Output is correct
21 Correct 18 ms 3044 KB Output is correct
22 Correct 22 ms 2472 KB Output is correct
23 Incorrect 23 ms 2796 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 4 ms 600 KB Output is correct
9 Correct 8 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1028 KB Output is correct
12 Correct 12 ms 1368 KB Output is correct
13 Correct 7 ms 1060 KB Output is correct
14 Correct 7 ms 1276 KB Output is correct
15 Correct 24 ms 2648 KB Output is correct
16 Correct 23 ms 2528 KB Output is correct
17 Correct 18 ms 2520 KB Output is correct
18 Correct 23 ms 3232 KB Output is correct
19 Correct 23 ms 2792 KB Output is correct
20 Correct 23 ms 2788 KB Output is correct
21 Correct 18 ms 3044 KB Output is correct
22 Correct 22 ms 2472 KB Output is correct
23 Incorrect 23 ms 2796 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 4 ms 600 KB Output is correct
9 Correct 8 ms 1112 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 5 ms 1028 KB Output is correct
12 Correct 12 ms 1368 KB Output is correct
13 Correct 7 ms 1060 KB Output is correct
14 Correct 7 ms 1276 KB Output is correct
15 Correct 24 ms 2648 KB Output is correct
16 Correct 23 ms 2528 KB Output is correct
17 Correct 18 ms 2520 KB Output is correct
18 Correct 23 ms 3232 KB Output is correct
19 Correct 23 ms 2792 KB Output is correct
20 Correct 23 ms 2788 KB Output is correct
21 Correct 18 ms 3044 KB Output is correct
22 Correct 22 ms 2472 KB Output is correct
23 Incorrect 23 ms 2796 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -