Submission #698192

# Submission time Handle Problem Language Result Execution time Memory
698192 2023-02-12T20:38:33 Z randmac Mobile (BOI12_mobile) C++14
0 / 100
174 ms 18284 KB
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <math.h>

using namespace std;

// https://oj.uz/problem/view/BOI12_mobile

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    //freopen("mobile.in", "r", stdin);
    //freopen("mobile.out", "w", stdout);

    int N, L;
    cin >> N >> L;

    vector<pair<int, int>> a(N);
    
    for (int i = 0; i < N; i++) {
        cin >> a[i].first >> a[i].second;
    }

    vector<pair<int, int>> b;
    int last_x = -1;
    for (auto it : a) {
        if (last_x != -1 && it.first == last_x) continue;
        b.push_back(it);
        last_x = it.first;
    }

    double ans = -1;
    for (int i = 0; i < b.size() - 1; i++) {
        int x_sum = b[i].first + b[i + 1].first;
        double y_squared = (double) (b[i].second + b[i+1].second) * abs(b[i].second - b[i+1].second);
        double x_0 = (x_sum - y_squared / x_sum) / 2;
        double distance = (b[i].first - x_0) * (b[i].first - x_0) + b[i].second * b[i].second;
        ans = max(ans, distance);
    }

    cout << sqrt(ans) << endl;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i = 0; i < b.size() - 1; i++) {
      |                     ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 2864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 2792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 3280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 3764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 10176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 6188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 90 ms 15084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 6856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 15932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 7636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 16704 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 150 ms 8376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 127 ms 18284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 174 ms 8196 KB Output isn't correct
2 Halted 0 ms 0 KB -