답안 #1104189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1104189 2024-10-23T07:48:06 Z EkinOnal Balloons (CEOI11_bal) C++17
30 / 100
78 ms 6728 KB
//#pragma GCC optimize("O3,unroll-loops,Ofast")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#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 MAX 200005
#define pb push_back
#define mp make_pair 
#define int long long
#define f first
#define s second
#define vi vector<int>
#define pii pair<int,int>
#define si set<int>
#define vpii vector<pair<int,int>> 
const int mod = 1e9+7;
const int INF = 1e18;
// myMap.begin()->first :  key
// myMap.begin()->second : value
 
int epow(int a,int b){int ans=1;while(b){if(b&1) ans*=a;a*=a;b>>=1;ans%=mod;a%=mod;}return ans%mod;}
int gcd(int a,int b) {if(a<b)swap(a,b);while(b){int tmp=b;b=a%b;a=tmp;}return a;}
int mul(long long a,long long b){return ((a%mod)*(b%mod))%mod;}
int sum(long long a,long long b){return ((a%mod)+(b%mod))%mod;}
 // typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
// typedef
// tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_multiset;


void solve(){
	int n; cin>>n;	
	vpii arr(n+2); for(int i=1;i<=n;i++) cin>>arr[i].f>>arr[i].s;

	stack<int> st;  vector<double> ans(n+2);
	for(int i=1;i<=n;i++){
		ans[i]=arr[i].s;
		while((int)st.size()){
			int node = st.top();
			double b = epow(arr[i].f-arr[node].f,2);
			b = b/(4.0*(double)ans[node]);
			if(b<(double)ans[i]) ans[i]=b;
			if((double)ans[i]>=(double)ans[node]) st.pop();
			else break;
		}
		st.push(i);
	}
	for(int i=1;i<=n;i++) printf("%.3lf\n",ans[i]);



  					
	return;
}
 
int32_t main(/*int32_t argc, char* argv[]*/){
	ios_base::sync_with_stdio(0); cin.tie(0);
	// freopen("dining.in", "r", stdin);
	// freopen("dining.out", "w", stdout);		
 
	int t=1;
//	cin >> t;
	while (t--) solve();
 
	return 0;	 			
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.2530000000', error = '252735385.1850000024'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB 2000 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 848 KB 5241st numbers differ - expected: '471.0110000000', found: '25.0880000000', error = '445.9230000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 1872 KB 4th numbers differ - expected: '15396.0000000000', found: '12876.3760000000', error = '2519.6240000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 3664 KB 13th numbers differ - expected: '7920.0000000000', found: '146.2960000000', error = '7773.7040000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 4008 KB 4643rd numbers differ - expected: '2427.0000000000', found: '868.6520000000', error = '1558.3480000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 59 ms 5408 KB 1734th numbers differ - expected: '1856.0220000000', found: '466.8070000000', error = '1389.2150000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 78 ms 6728 KB 2723rd numbers differ - expected: '859.0470000000', found: '623.8420000000', error = '235.2050000000'
2 Halted 0 ms 0 KB -