# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784178 | tvladm2009 | Xylophone (JOI18_xylophone) | C++17 | 80 ms | 856 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>
#include "xylophone.h"
using namespace std;
map<pair<int, int>, int> mp;
int ask(int l, int r) {
if (mp.count({l, r}) > 0) {
return mp[{l, r}];
}
int x = query(l, r);
mp[{l, r}] = x;
return x;
}
void solve(int n) {
mp.clear();
int mn = -1, mx = -1;
int low = 1, high = n;
while (low <= high) {
int mid = (low + high) / 2;
if (ask(1, mid) == n - 1) {
mx = mid;
high = mid - 1;
} else {
low = mid + 1;
}
}
low = 1, high = mx - 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |