Submission #1075564

# Submission time Handle Problem Language Result Execution time Memory
1075564 2024-08-26T07:43:56 Z Abito The Big Prize (IOI17_prize) C++17
0 / 100
56 ms 968 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int ans[N][2],S;
int find_best(int n) {
	int s=0,mx=0;
	for (int i=0;i<min(500,n);i++){
		vector<int> v=ask(i);
		ans[i][0]=v[0];
		ans[i][1]=v[1];
		if (v[0]+v[1]==0) return i;
		if (v[0]+v[1]>mx){
			mx=v[0]+v[1];
			s=i;
		}
	}
	S=n/mx;
	//cout<<s<<endl;
	for (int i=s;i+S<n;i+=S){
		vector<int> v=ask(i+S);
		ans[i+S][0]=v[0];
		ans[i+S][1]=v[1];
		if (v[0]+v[1]==0) return i+S;
		if (v[0]==ans[i][0] && v[1]==ans[i][1]) continue;
		for (int j=i+1;j<i+S;j++){
			v=ask(j);
			ans[j][0]=v[0];
			ans[j][1]=v[1];
			if (v[0]+v[1]==0) return j;
		}
	}
	for (int i=max(0,n-S);i<n;i++){
		vector<int> v=ask(i);
		ans[i][0]=v[0];
		ans[i][1]=v[1];
		if (v[0]+v[1]==0) return i;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 968 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 852 KB Incorrect
2 Halted 0 ms 0 KB -