Submission #697520

#TimeUsernameProblemLanguageResultExecution timeMemory
697520vjudge1Mobile (BOI12_mobile)C++17
0 / 100
34 ms16544 KiB
// euzubillahimineşşeytanirracimbismillahirrahmanirrahim // <- bak boşluk tuşun çalışıyo niye kullanmıyon #include <bits/stdc++.h> using namespace std; #define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout) #define fastio() cin.tie(0), ios_base::sync_with_stdio(0) #define pb push_back #define pii pair<int ,int> #define st first #define nd second #define sp " " #define endl "\n" #define N 1000005 #define int long long int x[N], y[N]; double l[N], r[N], sq[N]; const int INF = 1e18 + 7; int32_t main() { #ifndef ONLINE_JUDGE fileio(); #endif fastio(); queue<int> q; int n, L; cin >> n >> L; for (int i = 1; i <= n; i++) { cin >> x[i] >> y[i]; sq[i] = x[i] * x[i] + y[i] * y[i]; } q.push(1); l[1] = 0, r[1] = L; for (int i = 1; i <= n; i++) { int last = q.front(); if (x[i] == x[last]) continue; l[i] = INF; double p = (sq[i] - sq[last]) / (2 * (x[i] - x[last])); p = max(p, (double)0); while (!q.empty() && p < l[last]) { q.pop(); if (q.empty()) break; last = q.front(); p = (sq[i] - sq[last]) / (2 * (x[i] - x[last])); p = max(p, (double)0); } if (!q.empty()) { int last = q.front(); p = (sq[i] - sq[last]) / (2 * (x[i] - x[last])); p = max(p, (double)0); r[last] = p; } l[i] = p; r[i] = L; if (l[i] <= r[i]) q.push(i); } double ans = 0; for (int i = 1; i <= n; i++) { double gh = abs(x[i] - r[i]); double dist = y[i] * y[i] + gh * gh; ans = max(ans, dist); gh = abs(x[i] - l[i]); dist = y[i] * y[i] + gh * gh; ans = max(ans, dist); } double res = sqrt(ans); printf("%.5f\n", res); cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n"; }

Compilation message (stderr)

mobile.cpp: In function 'int32_t main()':
mobile.cpp:6:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:24:2: note: in expansion of macro 'fileio'
   24 |  fileio();
      |  ^~~~~~
mobile.cpp:6:59: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
      |                                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:24:2: note: in expansion of macro 'fileio'
   24 |  fileio();
      |  ^~~~~~
#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...