답안 #847630

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
847630 2023-09-10T05:32:32 Z hariaakas646 Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 15964 KB
#include <bits/stdc++.h>

using namespace std;

#define scd(t) scanf("%d", &t)
#define scld(t) scanf("%ld", &t)
#define sclld(t) scanf("%lld", &t)
#define scc(t) scanf("%c", &t)
#define scs(t) scanf("%s", t)
#define scf(t) scanf("%f", &t)
#define sclf(t) scanf("%lf", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long int li;
typedef unsigned long int uli;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;

void usaco()
{
    freopen("input.in", "r", stdin);
//    freopen("problem.out", "w", stdout);
}

int n;
lli l;
vector<pair<lli, lli>> vec;

ld dist(ld x1, ld y1, ld x2, ld y2) {
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

bool check(ld x) {
    ld prev = 0;
    
    forr(i, 1, n+1) {
        auto p = vec[i];
        if(prev <= p.f && dist(p.f, p.s, prev, 0) > x) {
            continue;
        }
        ld lo = p.f;
        ld hi = 1e9;
        while(hi - lo >= 1e-4) {
            ld mid = lo + (hi - lo)/2;
            if(dist(p.f, p.s, mid, 0) <= x) {
                lo = mid;
            }
            else {
                hi = mid;
            }
        }
        prev = max(lo, prev);
    }
    return prev >= l;
    
}

int main() {
    // usaco();

    
    scd(n);
    sclld(l);

    vec = vector<pair<lli, lli>>(n+1);

    forr(i, 1, n+1) {
        sclld(vec[i].f);
        sclld(vec[i].s);
    }

    ld lo = 0;
    ld hi = 4e9;

    while(hi - lo >= 1e-4) {
        ld mid = (lo + hi)/2;
        if(check(mid)) {
            hi = mid;
        }
        else lo = mid;
    }

    ld out = sqrt(ld(lo));
    cout << lo << "\n";

}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:99:8: warning: unused variable 'out' [-Wunused-variable]
   99 |     ld out = sqrt(ld(lo));
      |        ^~~
mobile.cpp: In function 'void usaco()':
mobile.cpp:37:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     freopen("input.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp: In function 'int main()':
mobile.cpp:5:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | #define scd(t) scanf("%d", &t)
      |                ~~~~~^~~~~~~~~~
mobile.cpp:78:5: note: in expansion of macro 'scd'
   78 |     scd(n);
      |     ^~~
mobile.cpp:7:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
mobile.cpp:79:5: note: in expansion of macro 'sclld'
   79 |     sclld(l);
      |     ^~~~~
mobile.cpp:7:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
mobile.cpp:84:9: note: in expansion of macro 'sclld'
   84 |         sclld(vec[i].f);
      |         ^~~~~
mobile.cpp:7:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
mobile.cpp:85:9: note: in expansion of macro 'sclld'
   85 |         sclld(vec[i].s);
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 348 KB Output is correct
2 Correct 6 ms 436 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 102 ms 456 KB Output is correct
2 Correct 109 ms 448 KB Output is correct
3 Correct 70 ms 436 KB Output is correct
4 Incorrect 86 ms 444 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 484 KB Output is correct
2 Incorrect 123 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 170 ms 484 KB Output is correct
2 Incorrect 123 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 176 ms 484 KB Output is correct
2 Incorrect 123 ms 484 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1042 ms 1368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1056 ms 1628 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 1624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1042 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1052 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1057 ms 8028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1057 ms 8028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 9820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1056 ms 9820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1032 ms 11352 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1068 ms 11356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1059 ms 12892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1066 ms 12892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1061 ms 15964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1031 ms 15960 KB Time limit exceeded
2 Halted 0 ms 0 KB -