Submission #605450

#TimeUsernameProblemLanguageResultExecution timeMemory
605450bzhu524Mobile (BOI12_mobile)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; pair<ll, ll> p[1000000]; int main() { ios_base::sync_with_stdio(false); int n, int len; cin >> n >> len; for (int i=0; i<n; i++) cin >> p[i].x >> p[i].y; double lower = 1; double upper = 1000000000; while (upper - lower >= 1e-3) { double mid = (upper + lower) / 2; double currPoint = 0; for (int i=0; i<n; i++) { ll x = p[i][0]; ll y = p[i][1]; double delta = sqrt(mid * mid - y * y); double p1 = x - delta; double p2 = x + delta; if (p1 <= currPoint) { currPoint = Math.max(currPoint, p2); } } if (currPoint < len) { lower = mid; } else { upper = mid; } } cout << setprecision(4) << l << "\n"; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:11:9: error: expected unqualified-id before 'int'
   11 |  int n, int len;
      |         ^~~
mobile.cpp:13:14: error: 'len' was not declared in this scope; did you mean 'mblen'?
   13 |  cin >> n >> len;
      |              ^~~
      |              mblen
mobile.cpp:15:38: error: 'struct std::pair<long long int, long long int>' has no member named 'x'
   15 |  for (int i=0; i<n; i++) cin >> p[i].x >> p[i].y;
      |                                      ^
mobile.cpp:15:48: error: 'struct std::pair<long long int, long long int>' has no member named 'y'
   15 |  for (int i=0; i<n; i++) cin >> p[i].x >> p[i].y;
      |                                                ^
mobile.cpp:24:15: error: no match for 'operator[]' (operand types are 'std::pair<long long int, long long int>' and 'int')
   24 |    ll x = p[i][0];
      |               ^
mobile.cpp:25:15: error: no match for 'operator[]' (operand types are 'std::pair<long long int, long long int>' and 'int')
   25 |    ll y = p[i][1];
      |               ^
mobile.cpp:32:17: error: 'Math' was not declared in this scope
   32 |     currPoint = Math.max(currPoint, p2);
      |                 ^~~~
mobile.cpp:43:29: error: 'l' was not declared in this scope
   43 |  cout << setprecision(4) << l << "\n";
      |                             ^