제출 #719512

#제출 시각아이디문제언어결과실행 시간메모리
719512Abhishek_szBalloons (CEOI11_bal)C++14
100 / 100
209 ms11328 KiB
//Problem Link : #include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define int long long int #define ld long double typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // Instead of less<int>, we can use greater<int>, less_equal<int> for descending, and having multiple occurence respectivly template<class T> using oset =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ; #define pb push_back #define mp make_pair #define fl(i, a, b) for (int i = a; i < b; i++) #define vi vector<int> #define e1(a) int a; cin>>a; #define e2(a,b) int a,b; cin>>a>>b; #define e3(a,b,c) int a,b,c; cin>>a>>b>>c; #define __builtin_LIVU() ios_base::sync_with_stdio(false);cin.tie(NULL) #define av(arr,n) vector<int> arr(n); fl(i,0,n) cin>>arr[i]; #define aa(arr,n) int arr[n]; fl(i,0,n) cin>>arr[i]; #define es(s) string(s); cin >> (s); #define rz resize #define vvi vector<vector<int>> #define sz(s) s.size() #define mod 1000000007 #define ff first #define ss second #define inf 10e15 #define all(x) (x).begin(), (x).end() #define pii pair<int, int> #define mii map<int,int> #define vl(n) cout << n << "\n" #define vs(n) cout << n << " " #define el cout<<"\n" #define rmin(a,b) (a=min((a),(b))) #define rmax(a,b) (a=max((a),(b))) #define UB upper_bound #define LB lower_bound #define vn(n) cout << n #define dsc greater<int>() #define ps(x,y) fixed<<setprecision(y)<<x #define R return #define B break #define C continue #define YC cout<<"YES"<<"\n" #define YS cout<<"Yes"<<"\n" #define NC cout<<"NO"<<"\n" #define fv(a) for(auto v:(a)) #define NS cout<<"No"<<"\n" #define lcm(a,b) (a/__gcd(a,b))*b #define pa(a) for(auto e:a)cout<<e<<" " const int N = 1e5 + 5; int dx[4] = { -1, 1, 0, 0}; int dy[4] = {0, 0, -1, 1}; int kx[8] = { -1, 1, 0, 0, -1, -1, 1, 1}; int ky[8] = {0, 0, -1, 1, -1, 1, -1, 1}; #ifndef ONLINE_JUDGE #define pra(a,n)cerr<<#a<<":";for(int i=0;i<n;i++)cerr<<a[i]<<" ";cerr<<endl; #define prm(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;} #define pr(...)dbs(#__VA_ARGS__,__VA_ARGS__) template<class S, class T>ostream &operator<<(ostream &os, const pair<S, T> &p) {return os << "(" << p.first << "," << p.second << ")";} template<class T>ostream &operator<<(ostream &os, const vector<T> &p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";} template<class T>ostream &operator<<(ostream &os, const set<T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";} template<class T>ostream &operator<<(ostream &os, const multiset<T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";} template<class S, class T>ostream &operator<<(ostream &os, const map<S, T>&p) {os << "["; for (auto&it : p)os << it << " "; return os << "]";} template<class T>void dbs(string str, T t) {cerr << str << ":" << t << "\n";} template<class T, class...S>void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << ":" << t << ","; dbs(str.substr(idx + 1), s...);} #else #define pr(...){} #define pra(a,n){} #define prm(mat,row,col){} #endif int sqrtll(int n) { int lo=0,hi=3037000499; while (hi-lo>1) { int m=(hi+lo)/2; if (m*m<=n) { lo=m; } else { hi=m-1; }} if (hi*hi<=n) { return hi; } return lo; } int cbrtll(int n) { int lo=0,hi=2097151; while (hi-lo>1) { int m=(hi+lo)/2; if (m*m*m<=n) { lo=m; } else { hi=m-1; }} if (hi*hi*hi<=n) { return hi; } return lo; } void modVal(int &a) { a%=mod;a+=mod;a%=mod; } // {x,r} ld maxR(pair<ld,ld>p,ld xC){ ld res=0; res=(p.ff-xC);res*=res; res/=4.0; res/=p.ss; return res; } void solve() { /*It's WA on 2, oh cleared, This shit is onna get me TLE. Better luck next time buddy.*/ /*USE DOUBLE HASHING RATHER THAN SINGLE HASHING !!!!*/ e1(n); ld xC[n],mR[n]; fl(i,0,n){ cin>>xC[i]>>mR[i]; } ld ans[n]; ans[0]=mR[0]; stack<pair<ld,ld>>st; ld eps=1e-4; st.push({xC[0],ans[0]}); fl(i,1,n){ pair<ld,ld>p=st.top(); ld rad=maxR(p,xC[i]); rad=min(rad,mR[i]); while(st.size() && rad>=p.ss){ st.pop(); if(st.size()){ p=st.top(); rad=min(rad,maxR(p,xC[i])); rad=min(rad,mR[i]); } } ans[i]=rad; st.push({xC[i],ans[i]}); } fl(i,0,n){ cout<<ps(ans[i],3)<<"\n"; } cout<<endl; } int32_t main() { __builtin_LIVU(); int t = 1; // cin >> t; fl(i, 1, t + 1) { solve(); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bal.cpp: In function 'void solve()':
bal.cpp:101:8: warning: unused variable 'eps' [-Wunused-variable]
  101 |     ld eps=1e-4;
      |        ^~~
#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...