Submission #71542

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
715422018-08-25 05:32:10top34051Shortcut (IOI16_shortcut)C++17
71 / 100
808 ms4488 KiB
#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);
double 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];
// double r1 = (pos[x] + pos[y] - d)/(2.0*sqrt(2)), c1 = (-pos[x] + pos[y] - d)/(2.0*sqrt(2));
// double r2 = (pos[x] + pos[y] + d)/(2.0*sqrt(2)), c2 = (-pos[x] + pos[y] + d)/(2.0*sqrt(2));
// printf("%d %d: (%.3lf, %.3lf) (%.3lf, %.3lf)\n",x,y,r1,c1,r2,c2);
r1 = max(r1, (pos[x] + pos[y] - d)/(2.0*sqrt(2)));
c1 = max(c1, (-pos[x] + pos[y] - d)/(2.0*sqrt(2)));
r2 = min(r2, (pos[x] + pos[y] + d)/(2.0*sqrt(2)));
c2 = min(c2, (-pos[x] + pos[y] + d)/(2.0*sqrt(2)));
}
}
for(int x=0;x<n;x++) {
for(int y=x+1;y<n;y++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...