Submission #1183272

#TimeUsernameProblemLanguageResultExecution timeMemory
1183272nevuorigBalloons (CEOI11_bal)C++20
40 / 100
2096 ms3648 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll int #define ld double #define str string #define pb push_back #define pf push_front #define pob pop_back() #define pof pop_front() #define in insert #define fi first #define se second #define size size() #define begin begin() #define end end() #define back back() #define front front() #define rend rend() #define rbegin rbegin() #define ret return #define ull unsigned long long #define all(a) a.begin , a.end #define gcd __gcd #define lcm(a , b) (a * b) / gcd(a , b) #define friopen freopen ("exercise.in", "r", stdin); freopen("exercise.out", "w", stdout); using namespace std; using namespace __gnu_pbds; typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds; const ll mod = 1e9 + 7 , mod2 = 998244353 , N = 5e5 , inf = 1e18; const ld esp = 0.0000001 , Pi = 3.1415926535897932384626433832795; ld dist(ld x1 , ld y1 , ld x2 , ld y2) { ret sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } void kol_a() { cout << fixed << setprecision(5); ll n , i , j; cin >> n; ld x[n + 12] = {} , v[n + 12] = {}; for (i = 1 ; i <= n ; i ++) { ld l = 0 , r , m; cin >> x[i] >> r; r += esp; while(l + esp < r) { m = (l + r) / 2; for (j = 1 ; j < i ; j ++) { if (dist(x[i] , m , x[j] , v[j]) <= m + v[j]) { r = m; goto to; } } l = m; to:; } v[i] = l; cout << l << '\n'; } } main() { // friopen ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll _ = 1; // cin >> _; while(_ --) kol_a(); } /* */

Compilation message (stderr)

bal.cpp:45:61: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   45 | const ll mod = 1e9 + 7 , mod2 = 998244353 , N = 5e5 , inf = 1e18;
      |                                                             ^~~~
bal.cpp:84:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   84 | main()
      | ^~~~
#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...