Submission #821161

# Submission time Handle Problem Language Result Execution time Memory
821161 2023-08-11T07:52:18 Z vjudge1 Simurgh (IOI17_simurgh) C++17
Compilation error
0 ms 0 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;



int find_best(int n){
    int mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
    map<int,int>mp[2];
    vector<pair<int,int>> v;
    for(i = 0; i < n; i++)
        mp[0][i] = mp[1][i] = -1;
    for(i = 0; i < min(n, 700); i++){
        vector<int>gt = ask(i);
        mp[0][i] = gt[0];
        mp[1][i] = gt[1];
        v.push_back({gt[0] + gt[1] , i});
        if((gt[0] + gt[1]) == 0)
            return i;
        if((gt[0] + gt[1]) >= mx)
                mx = gt[0] + gt[1] , x = gt[0] ,  k = i;
    }

    while(k < n){
        l = k;
        r = n - 1;
        m = l + 12;
        f = 0;
        if((m + 2) < n){
            vector<int>gp;
            if(mp[0][m] == -1)
                gp = ask(m);
            else
                gp.push_back(mp[0][m]) , gp.push_back(mp[1][m]);
            int sum = gp[0] + gp[1];
            if(sum == 0)
                return m;
            if(!(sum == mx && (gp[0] == x))){
                f = 1;
                while(true){
                    vector<int>gp;
                    if(mp[0][l + 1] == -1)
                        gp = ask(l + 1);
                    else
                        gp.push_back(mp[0][l + 1]) , gp.push_back(mp[1][l + 1]);
                    int sum = gp[0] + gp[1];
                    if(sum == 0)
                        return (l + 1);
                    if((sum == mx && (gp[0] == x))){
                       l++;
                    }else {
                    x = gp[0];
                    k = l;
                    break;
                    }
            }
        }
        }
        if(f == 0)
        while(l != r){
            m = (l + r + 1) / 2;
            vector<int>gt;
            if(mp[0][m] == -1)
                gt = ask(m);
            else
                gt.push_back(mp[0][m]) , gt.push_back(mp[1][m]);
            mp[0][m] = gt[0];
            mp[1][m] = gt[1];
            int sum = gt[0] + gt[1];
            if(sum == 0)
                return m;
            if(sum == mx && (gt[0] == x)){
                l =  m;
            }else {
                r = m - 1;
            }
        }
        k = l + 1;
        while(k < n){
            vector<int>gt;
            if(mp[0][k] == -1)
            gt = ask(k);
            else
                gt.push_back(mp[0][k]) , gt.push_back(mp[1][k]);
            mp[0][k] = gt[0];
            mp[1][k] = gt[1];
            int sum = gt[0] + gt[1];
            x = gt[0];
            if(sum == 0)
                return k;
            if(sum < mx)
                v.push_back({sum , k});
            else
                break;
            k++;
        }
    }
    sort(v.begin() , v.end());
    return v[0].second;
}

Compilation message

simurgh.cpp:2:10: fatal error: prize.h: No such file or directory
    2 | #include "prize.h"
      |          ^~~~~~~~~
compilation terminated.