답안 #62937

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62937 2018-07-31T01:23:09 Z Benq Mobile (BOI12_mobile) C++11
60 / 100
322 ms 132096 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 1000001;
 
int N,L;
pi v[MX];
ld tmp[MX];
 
ld perp(pd x, pd y) {
    return (y.f*y.f+y.s*y.s-x.f*x.f-x.s*x.s)/(2*y.f-2*x.f);
}
 
ld dist(pd a, pd b) {
    return sqrt(pow(a.f-b.f,2)+pow(a.s-b.s,2));
}
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> L;
    int nex = 0;
    F0R(i,N) {
        int x,y; cin >> x >> y; y = abs(y);
        if (nex && v[nex-1].f == x) {
            if (y >= v[nex-1].s) continue;
            else nex --;
        }
        while (nex && tmp[nex-1] >= perp(v[nex-1],{x,y})) nex --;
        v[nex] = {x,y};
        if (nex) tmp[nex] = perp(v[nex-1],v[nex]);
        nex ++;
    }
    ld ans = 0;
    F0R(i,nex) {
        ld mn = (i == 0 ? -INF : tmp[i]);
        ld mx = (i == nex-1 ? INF : tmp[i+1]);
        if (mx < 0 || mn > L) continue;
        mn = max(mn,(ld)0), mx = min(mx,(ld)L);
        ans = max(ans,dist(v[i],{mn,0}));
        ans = max(ans,dist(v[i],{mx,0}));
    }
    cout << fixed << setprecision(6) << ans;
}
 
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( ) 
* special cases (n=1?)
* overflow (ll vs int?)
* array bounds
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 500 KB Output is correct
2 Correct 4 ms 652 KB Output is correct
3 Correct 4 ms 652 KB Output is correct
4 Correct 2 ms 652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 652 KB Output is correct
2 Correct 5 ms 792 KB Output is correct
3 Correct 4 ms 792 KB Output is correct
4 Correct 5 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 952 KB Output is correct
2 Correct 7 ms 952 KB Output is correct
3 Correct 4 ms 1016 KB Output is correct
4 Correct 6 ms 1056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1128 KB Output is correct
2 Correct 5 ms 1204 KB Output is correct
3 Correct 5 ms 1244 KB Output is correct
4 Correct 4 ms 1284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1356 KB Output is correct
2 Correct 5 ms 1408 KB Output is correct
3 Correct 5 ms 1480 KB Output is correct
4 Correct 6 ms 1516 KB Output is correct
5 Correct 5 ms 1596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 2532 KB Output is correct
2 Correct 24 ms 3436 KB Output is correct
3 Correct 17 ms 4144 KB Output is correct
4 Correct 31 ms 5280 KB Output is correct
5 Correct 13 ms 5764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 6452 KB Output is correct
2 Correct 23 ms 7196 KB Output is correct
3 Correct 26 ms 8324 KB Output is correct
4 Correct 24 ms 9412 KB Output is correct
5 Correct 28 ms 10868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 13632 KB Output is correct
2 Correct 40 ms 13632 KB Output is correct
3 Correct 25 ms 14568 KB Output is correct
4 Correct 50 ms 15720 KB Output is correct
5 Correct 27 ms 16572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 18264 KB Output is correct
2 Correct 50 ms 19572 KB Output is correct
3 Correct 26 ms 20856 KB Output is correct
4 Correct 36 ms 22540 KB Output is correct
5 Correct 33 ms 23856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 26140 KB Output is correct
2 Correct 29 ms 26756 KB Output is correct
3 Correct 29 ms 27912 KB Output is correct
4 Correct 57 ms 29712 KB Output is correct
5 Correct 30 ms 31096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 47004 KB Output is correct
2 Correct 141 ms 47004 KB Output is correct
3 Correct 139 ms 50348 KB Output is correct
4 Correct 193 ms 59884 KB Output is correct
5 Correct 175 ms 66764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 206 ms 74880 KB Output is correct
2 Correct 183 ms 82388 KB Output is correct
3 Correct 134 ms 88300 KB Output is correct
4 Correct 172 ms 96752 KB Output is correct
5 Correct 175 ms 103932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 123228 KB Output is correct
2 Correct 214 ms 123228 KB Output is correct
3 Correct 157 ms 126996 KB Output is correct
4 Runtime error 255 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 187 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 191 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 210 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 189 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 211 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 300 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 322 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -