# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71557 | top34051 | Shortcut (IOI16_shortcut) | C++17 | 582 ms | 2304 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 "shortcut.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 3000 + 5;
const ll inf = 1e15;
int n;
ll cost, len[maxn], val[maxn];
ll pos[maxn];
bool check(ll k) {
// printf("check %lld\n",k);
ll r1 = -inf, r2 = inf, c1 = -inf, c2 = inf;
for(int x=0;x<n;x++) {
for(int y=x+1;y<n;y++) {
if(val[x] + val[y] + pos[y] - pos[x] <= k) continue;
ll d = k - cost - val[x] - val[y];
r1 = max(r1, pos[x] + pos[y] - d);
c1 = max(c1, -pos[x] + pos[y] - d);
r2 = min(r2, pos[x] + pos[y] + d);
c2 = min(c2, -pos[x] + pos[y] + d);
}
}
for(int x=0;x<n;x++) {
for(int y=x+1;y<n;y++) {
ll r = (pos[x]+pos[y]), c = (-pos[x]+pos[y]);
if(r1 <= r && r <= r2 && c1 <= c && c <= c2) return 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... |
# | 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... |