Submission #820981

#TimeUsernameProblemLanguageResultExecution timeMemory
820981vjudge1The Big Prize (IOI17_prize)C++17
0 / 100
1 ms336 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"


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)

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