Submission #698197

#TimeUsernameProblemLanguageResultExecution timeMemory
698197randmacMobile (BOI12_mobile)C++14
0 / 100
167 ms16452 KiB
#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; int x_diff = b[i + 1].first - b[i].first; double y_squared = (b[i + 1].second + b[i].second) * (b[i + 1].second - b[i].second); double x_0 = ( y_squared / x_diff + 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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...