# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
676438 | 2022-12-30T22:46:09 Z | smirichto | Balloons (CEOI11_bal) | C++17 | 2000 ms | 9968 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll ; typedef long double ld ; #define FAST ios::sync_with_stdio(0), cin.tie(0),cout.tie(0) #define pb push_back #define pi pair<int , int> #define pll pair<ll,ll> #define yes cout<<"Yes"<<endl; #define no cout<<"No"<<endl; #define firsst cout<<"First"<<endl; #define seconnd cout<<"Second"<<endl; #define tiie cout<<"Tie"<<endl; #define fr(i,a,b) for(ll i = a;i < (ll)b;i++) #define rfr(i,a,b) for(ll i = a;i > (ll)b;i--) #define F first #define S second #define all(x) (x).begin(), (x).end() #define alll(x) ((x).begin()+1), (x).end() #define MOD mod #define endl '\n' //#define uid(a, b) uniform_ll_distribution<ll>(a, b)(rng) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const ll mod = 2019201997 ; void io(){ios::sync_with_stdio(false) ;cin.tie(NULL) ; freopen("walk.in","r",stdin) ;freopen("walk.out","w",stdout) ; } void dbg(vector<ll> tab){for(auto it : tab) cout<<it<<" ";cout<<endl;} void dbgg(pi p){cout<<p.F<<" "<<p.S<<endl;} void dbgpi(vector<pi> tab){for(auto it : tab) dbgg(it) ;} template<class T> bool ckmax(T& a, const T& b){return a <= b ? a = b, 1 : 0;} template<class T> bool ckmin(T& a, const T& b){return a >= b ? a = b, 1 : 0;} template<class T> void add(T& a, const T& b){a = a + b ; if(a>mod) a-= mod ;} void nop(){cout<<-1<<endl;return;} const ll N = 1e3+5 ; ld sq(ld x){ return x*x ; } ld dist(ld x , ld y , ld xx , ld yy) { return sqrtl(sq(x-xx) + sq(y-yy)) ; } void solve() { int n ; cin>>n ; vector<ld> x(n+1) , r(n+1) , ans(n+1) ; for(int i = 1 ; i<=n ; i++){ cin>>x[i]>>r[i] ; } ld ppi = acos(-1) ; cout<<fixed<<setprecision(3); cout<<r[1]<<endl; ans[1] = r[1] ; for(int i =2 ; i<=n ; i++){ ld l = 0 , rr = r[i] ; ld p = l ; int k = 60 ; while(k--){ ld md = (l+rr)/2 ; bool ok = true ; for(int j = 1 ; j<i ; j++){ if(ans[j] + md > dist(x[j] , ans[j] , x[i] , md)) ok = false ; } if(ok){ p = md ; l = md ; } else rr = md ; } cout<<p<<endl; ans[i] = p ; } } int main() { // io() ; ll tt = 1 ; // cin>>tt ; while(tt--) solve() ; return 0 ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 63 ms | 312 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 708 ms | 404 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2061 ms | 1272 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2084 ms | 2812 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2074 ms | 5276 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2080 ms | 5880 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2082 ms | 7684 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2035 ms | 9968 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |