Submission #641734

# Submission time Handle Problem Language Result Execution time Memory
641734 2022-09-17T13:55:50 Z Vladth11 The Potion of Great Power (CEOI20_potion) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "potion.h"
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "

using namespace std;
typedef long long ll;
typedef pair <int, int> pii;

const int NMAX = 100001;
const int VMAX = 101;
const int INF = 2e9;
const int MOD = 1000000007;
const int BLOCK = 447;
const int base = 117;
const int nr_of_bits = 24;
const int inv2 = 500000004;

vector <pii> events[NMAX];
int a[NMAX];

void init(int N, int D, int H[]) {
    for(int i = 0; i < N; i++){
        a[i] = H[i];
    }
}

void curseChanges(int U, int A[], int B[]) {
    for(int i = 0; i < U; i++){
        events[A[i]].push_back({B[i], i});
        events[B[i]].push_back({A[i], i});
    }
}

int question(int x, int y, int v) {
    set <int> stX, stY;
    for(auto p : events[x]){
        if(p.second + 1 > v) break;
        if(stX.find(p.first) == stX.end())
            stX.insert(p.first);
        else stX.erase(p.first);
    }
    for(auto p : events[y]){
        if(p.second + 1 > v) break;
        if(stY.find(p.first) == stY.end())
            stY.insert(p.first);
        else stY.erase(p.first);
    }
    int last, ultim = -1;
    int minim = 1e9;
    if(stX.size() == 0 || stY.size() == 0)
        return minim;
    set <int> nou;
    for(auto p : stX){
        nou.insert(a[p]);
    }
    for(auto p : stY){
        int val = a[p];
        auto it = nou.lower_bound(val);
        if(it != nou.end()){
            minim = min(minim, abs((*it) - val));
        }
        it = nou.upper_bound(val);
        if(it != nou.begin()){
            it = prev(it);
            minim = min(minim, abs((*it) - val));
        }
    }
    return minim;
}

Compilation message

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