# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
389177 | couplefire | Road Construction (JOI21_road_construction) | C++17 | 2893 ms | 48956 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>
using namespace std;
#define MAXN 250000
#define INF 1000000000000000009ll
#define ll long long
int n, k;
vector<ll> ans;
set<pair<ll, ll>> st;
map<ll, vector<ll>> mp;
bool check(ll mid){
ans.clear();
st.clear();
for(auto &i : mp){
vector<ll> &v = i.second;
ll x = i.first;
for(auto &y : v){
auto it = st.lower_bound({y-mid, -INF});
while(it != st.end() && (*it).first <= y+mid){
ans.push_back(max(abs((*it).first-y),x-(*it).second));
if((int)ans.size() > k) return 0;
it = next(it);
}
st.insert({y, x});
}
if(!mp.count(x-mid)) continue;
vector<ll> &tmp = mp[x-mid];
for(auto &y : tmp) st.erase({y, x-mid});
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |