Submission #398271

#TimeUsernameProblemLanguageResultExecution timeMemory
398271AriaHMobile (BOI12_mobile)C++11
100 / 100
520 ms35196 KiB
/** vaziat sorati ghermeze **/ #pragma GCC optimize("Ofast") #pragma GCC target("avx") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define all(x) (x).begin(),(x).end() #define F first #define S second #define Mp make_pair #define SZ(x) (int)x.size() #define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define file_io freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout); const int N = 1e6 + 10; const ll mod = 1e9 + 7; const ll mod2 = 998244353; const ll inf = 8e18; const ld one = 1.; const ld eps = 1e-15; int n, L, X[N], Y[N]; ld base[N]; pair < ld, ld > arr[N]; int check(ld x) { ld right = 0; for(int i = 1; i <= n; i ++) { if(abs(Y[i]) - x > eps) continue; ld l = sqrt(x * x - base[i]); if(right - (X[i] - l) > eps) { if((X[i] + l) - right > eps) { right = X[i] + l; if(right - L > eps) return 1; } } } return 0; } int main() { scanf("%d%d", &n, &L); for(int i = 1; i <= n; i ++) { scanf("%d%d", &X[i], &Y[i]); base[i] = one * Y[i] * Y[i]; } ld d = 0, up = 3e9; ///printf("checking %d\n", check(6)); for(int _ = 0; _ < 44; _ ++) { ld mid = (up + d) / 2.0; if(check(mid)) { up = mid; } else { d = mid; } } printf("%.4lf", up); return 0; } /** test corner cases(n = 1?) watch for overflow or minus indices **/

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:54:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   54 |  scanf("%d%d", &n, &L);
      |  ~~~~~^~~~~~~~~~~~~~~~
mobile.cpp:57:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   57 |   scanf("%d%d", &X[i], &Y[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...