# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
465581 | lukadupli | Fountain (eJOI20_fountain) | C++14 | 786 ms | 18864 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>
#define f first
#define s second
using namespace std;
typedef pair <int, int> pii;
const int MAXN = 1e5 + 5;
int n, q;
pii info[MAXN], child_pow2[MAXN][20];
vector <pii> available;
int main()
{
cin >> n >> q;
for(int i = 1; i <= n; i++) cin >> info[i].f >> info[i].s;
for(int i = n; i >= 1; i--){
while(!available.empty() && available.back().f <= info[i].f) available.pop_back();
if(available.empty()) child_pow2[i][0] = {0, info[i].s};
else child_pow2[i][0] = {available.back().s, info[i].s};
available.push_back({info[i].f, i});
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |