# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133124 | 2019-07-20T07:46:41 Z | sealnot123 | Mobile (BOI12_mobile) | C++14 | 308 ms | 31492 KB |
#include<bits/stdc++.h> #define x first #define y second #define pb push_back #define eb emplace_back #define all(a) (a).begin(),(a).end() #define SZ(a) (int)(a).size() using namespace std; typedef long long LL; typedef pair<LL,LL> PLL; typedef pair<int,int> PII; typedef double D; typedef long double LD; const int N = 1000007; PLL tower[N]; PLL intersect(PLL a, PLL b){ LL A, B; A = a.y - b.y; B = b.x - a.x; if(B < 0) A = -A, B = -B; return {A, B}; } vector<PLL> line; void add(PLL nw){ while(SZ(line)>1){ int a = SZ(line); if(line[a-1].x == nw.x) return; PLL tmp1 = intersect(line[a-2], line[a-1]); PLL tmp2 = intersect(line[a-1], nw); if(tmp2.x*tmp1.y < tmp1.x*tmp2.y) line.pop_back(); else break; } line.pb(nw); } LD calc(LD a, int b){ return a*line[b].x + line[b].y; } LL L; int n; int main(){ int i,j; LL a,b; scanf("%d %lld",&n,&L); for(i=1;i<=n;i++){ scanf("%lld%lld",&a,&b); tower[i] = {-a*2ll, a*a + b*b}; } sort(tower+1, tower+1+n); for(i=1;i<=n;i++){ add(tower[i]); } LD ans = 0; for(i = 0; i < SZ(line)-1; i++){ PLL tmp = intersect(line[i], line[i+1]); LD tmp2 = (LD)tmp.x/tmp.y; if(tmp2 < 0 || tmp2 > L) continue; ans = max(ans, calc(tmp2, i) + tmp2*tmp2); } for(i=0; i<SZ(line)-1; i++){ if(calc(0, i) <= calc(0, i+1)) break; } ans = max(ans, calc(0, i)); for(i=0; i<SZ(line)-1; i++){ if(calc(L, i) <= calc(L, i+1)) break; } ans = max(ans, calc(L, i) + L*L); printf("%Lf",sqrt(ans)); return 0; } /* 2 10 0 0 11 1 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 20 ms | 2168 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2296 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 2412 KB | Output is correct |
2 | Incorrect | 29 ms | 3064 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 37 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 2552 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 115 ms | 8868 KB | Output is correct |
2 | Incorrect | 153 ms | 15856 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 155 ms | 8772 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 138 ms | 10488 KB | Output is correct |
2 | Incorrect | 186 ms | 19088 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 187 ms | 10292 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 163 ms | 11976 KB | Output is correct |
2 | Incorrect | 222 ms | 22240 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 220 ms | 11896 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 190 ms | 13560 KB | Output is correct |
2 | Incorrect | 269 ms | 25352 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 254 ms | 13432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 234 ms | 16760 KB | Output is correct |
2 | Incorrect | 308 ms | 31492 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 308 ms | 16064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |