Submission #56124

# Submission time Handle Problem Language Result Execution time Memory
56124 2018-07-10T05:05:23 Z 강태규(#1579) Mobile (BOI12_mobile) C++11
0 / 100
427 ms 8448 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

const int inf = 1e9 + 7;
int n, l, m = -1;
int x[1000000];
int y[1000000];

llong sq(int x) {
    return (llong)x * x;
}

int main() {
    scanf("%d%d", &n, &l);
    for (int i = 0, pr = inf; i < n; ++i) {
        int xs, ys;
        scanf("%d%d", &xs, &ys);
        ys = abs(ys);
        if (xs != pr) {
            x[++m] = xs;
            y[m] = ys;
            pr = xs;
        }
        else {
            y[m] = min(y[m], ys);
        }
    }
    
    ld ans = 0;
    for (int i = 1; i <= m; ++i) {
        ld t = sq(y[i - 1]) - sq(y[i]) + sq(x[i] - x[i - 1]);
        t = t / (2ll * (x[i] - x[i - 1]));
        t = t * t + sq(y[i]);
        ans = max(ans, t);
    }
    
    ans = max(ans, (ld)(sq(x[0]) + sq(y[0])));
    ans = max(ans, (ld)(sq(l - x[m]) + sq(y[m])));
    ans = sqrt(ans);
    llong x = ans, y = ans * 10000;
    char st[100];
    int tp = 0;
    while (x) {
        st[tp++] = x % 10 + '0';
        x /= 10;
    }
    for (int i = tp; i--; ) printf("%c", st[i]);
    printf(".");
    for (int i = 1000; i; i /= 10) printf("%d", y / i % 10);
	return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:66:59: warning: format '%d' expects argument of type 'int', but argument 2 has type 'llong {aka long long int}' [-Wformat=]
     for (int i = 1000; i; i /= 10) printf("%d", y / i % 10);
                                                 ~~~~~~~~~~^
mobile.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &l);
     ~~~~~^~~~~~~~~~~~~~~~
mobile.cpp:34:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &xs, &ys);
         ~~~~~^~~~~~~~~~~~~~~~~~
# 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 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1196 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 1196 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 1204 KB Output is correct
2 Incorrect 26 ms 1204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 4544 KB Output is correct
2 Incorrect 183 ms 4544 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 134 ms 4544 KB Output is correct
2 Incorrect 150 ms 4620 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 135 ms 5496 KB Output is correct
2 Incorrect 142 ms 5496 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 155 ms 5496 KB Output is correct
2 Incorrect 191 ms 5496 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 248 ms 6200 KB Output is correct
2 Incorrect 178 ms 6200 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 183 ms 6200 KB Output is correct
2 Incorrect 249 ms 6200 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 192 ms 6756 KB Output is correct
2 Incorrect 215 ms 6756 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 207 ms 6756 KB Output is correct
2 Incorrect 243 ms 6884 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 212 ms 8448 KB Output is correct
2 Incorrect 311 ms 8448 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 427 ms 8448 KB Output is correct
2 Incorrect 272 ms 8448 KB Output isn't correct
3 Halted 0 ms 0 KB -