# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1114259 |
2024-11-18T13:11:02 Z |
asli_bg |
Balloons (CEOI11_bal) |
C++11 |
|
463 ms |
4732 KB |
#include <bits/stdc++.h>
using namespace std;
#define int double
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sp <<' '<<
#define FOR(i,a) for(int i=0;i<(a);i++)
#define FORE(i,a,b) for(int i=(a);i<(b);i++)
#define cont(a) for(auto el:a) cout<<el<<' '; cout<<endl;
#define contp(a) for(auto el:a) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl;
#define DEBUG(x) cout<<#x sp ":" sp x<<endl;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef long long ll;
#define endl '\n'
#define mid (l+r)/2
const int MAXN=2e5+5;
int n;
bool check(int a,int b,int c){
//c max possible hipotenus
int hipo=pow(a,2)+pow(b,2);
if(c>=sqrt(hipo)) return true; //kesişiyorlar
return false;
}
int findr(int mxr,int prevr,int xfark){ //kesiştikleri son noktayı bul
int l=0;
int r=mxr;
FOR(i,50){
if(check(abs(mid-prevr),xfark,mid+prevr)) r=mid;
else l=mid;
}
return l;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout<<fixed<<setprecision(3);
cin>>n;
vi cev(n+1,0);
stack<pii> s; //{x eksenini nereden keser, radyan ne kadar}
FORE(i,1,n+1){
int x,r;
cin>>x>>r;
pii el;
while(!s.empty() and r>el.se){
el=s.top();
int deg=findr(r,el.se,x-el.fi);
r=deg;
if(r>el.se) s.pop();
}
s.push({x,r});
cout<<r<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
336 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
336 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
668 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
111 ms |
1468 KB |
50000 numbers |
2 |
Correct |
114 ms |
1160 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
245 ms |
2116 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
275 ms |
2508 KB |
115362 numbers |
2 |
Correct |
274 ms |
2000 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
370 ms |
3144 KB |
154271 numbers |
2 |
Correct |
463 ms |
4732 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
455 ms |
3404 KB |
200000 numbers |
2 |
Correct |
448 ms |
3092 KB |
199945 numbers |