# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1114257 |
2024-11-18T13:08:31 Z |
asli_bg |
Balloons (CEOI11_bal) |
C++11 |
|
31 ms |
3920 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)){
//kesişiyorlar
return true;
}
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;
if(i==1) s.push({x,r});
else{
pii el;
while(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 |
Runtime error |
2 ms |
592 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
592 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
592 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
592 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
1020 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
31 ms |
2328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
19 ms |
2640 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
2908 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
3152 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
3920 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |