# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
389180 | couplefire | Road Construction (JOI21_road_construction) | C++17 | 3688 ms | 36820 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 INF 1000000000000000009ll
#define ll long long
int n, k;
vector<ll> ans;
set<pair<ll, ll>> st;
map<ll, vector<ll>> mp;
queue<pair<ll, ll>> active;
bool check(ll mid){
ans.clear();
st.clear();
active = queue<pair<ll, ll>>();
for(auto &i : mp){
vector<ll> &v = i.second;
ll x = i.first;
while(!active.empty() && active.front().second < x-mid) st.erase(active.front()), active.pop();
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),abs(x-(*it).second)));
if((int)ans.size() > k) return 0;
it = next(it);
}
st.insert({y, x});
active.push({y, x});
}
}
# | 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... |