Submission #820963

#TimeUsernameProblemLanguageResultExecution timeMemory
820963vjudge1The Big Prize (IOI17_prize)C++17
0 / 100
20 ms24196 KiB

#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"


const int N = 5e5 + 9 , mod = 1e9 + 7;
ll  d[N] , a[N] = {}, dp[N] ,  b[N] , c[N];

vector<int>vc[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 - k)){
                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)

prize.cpp: In function 'std::vector<int> get(int)':
prize.cpp:32:1: warning: no return statement in function returning non-void [-Wreturn-type]
   32 | }
      | ^
prize.cpp: In function 'int find_best(int)':
prize.cpp:35:22: warning: unused variable 'j' [-Wunused-variable]
   35 |     ll mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                      ^
prize.cpp:35:30: warning: unused variable 's' [-Wunused-variable]
   35 |     ll mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                              ^
prize.cpp:35:34: warning: unused variable 'f' [-Wunused-variable]
   35 |     ll mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                                  ^
prize.cpp:35:50: warning: unused variable 'c' [-Wunused-variable]
   35 |     ll mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                                                  ^
prize.cpp:35:54: warning: unused variable 'y' [-Wunused-variable]
   35 |     ll mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                                                      ^
prize.cpp:35:58: warning: variable 'x' set but not used [-Wunused-but-set-variable]
   35 |     ll mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                                                          ^
prize.cpp:60:15: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
   60 |         k = l + 1;
      |             ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...