| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 820981 | vjudge1 | The Big Prize (IOI17_prize) | C++17 | 1 ms | 336 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"
vector<int> get(int n){
}
int find_best(int n){
ll mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
vector<pair<int,int>>vc , v;
for(i = 0; i < min(n, 1000); i++){
vector<int>gt = get(i);
vc.pb({gt[0] + gt[1] , i});
if(gt[0] + gt[1] > mx)
mx = gt[0] + gt[1] , x = gt[0] , k = i;
}
sort(all(vc));
for(auto to : v)
if(to.fi != mx)
v.pb({to.fi , to.se});
while(k < n){
l = k;
r = n - 1;
while(l != r){
m = (l + r + 1) / 2;
vector<int>gt = get(m);
ll sum = gt[0] + gt[1];
if(sum == mx && (gt[0] - k) == (m - x)){
l = m;
}else {
r = m - 1;
}
}
k = l + 1;
while(k < n){
vector<int>gt = get(k);
ll sum = gt[0] + gt[1];
x = gt[0];
if(sum < mx){
v.pb({sum , k});
}else {
break;
}
k++;
}
}
sort(all(v));
return v[0].se;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
