Submission #1023336

# Submission time Handle Problem Language Result Execution time Memory
1023336 2024-07-14T16:26:18 Z EkinOnal Balloons (CEOI11_bal) C++17
0 / 100
29 ms 15952 KB
//#pragma GCC optimize("O3,unroll-loops,Ofast")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
//#include <cstdio>
//#include <iostream>
using namespace std;
 
#define MAX 100007
#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 = 2019201997;
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;ans%=mod;a%=mod;b>>=1;}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;}
long long mul(long long a,int b){return ((a%mod)*(b%mod))%mod;}


int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

struct DSU {
	vi e,sayi; void init(int N) { e = vi(N,-1); sayi = vi(N);}
	int get(int x) { return e[x] < 0 ? x : e[x] = get(e[x]); } 
	bool sameSet(int a, int b) { return get(a) == get(b); }
	int size(int x) { return -e[get(x)]; }
	bool unite(int x, int y) { // union by size
		x = get(x), y = get(y); if (x == y) return 0;
		if (e[x] > e[y]) swap(x,y);
		e[x] += e[y]; e[y] = x; sayi[x]+=sayi[y]; return 1;
	}
};


void solve() 
{	
	int n; cin >> n;
	vector<pii> v(n+2);
	for(int i=1;i<=n;i++) cin >> v[i].f >> v[i].s;
	
	stack<pii> st;
	st.push({1LL,v[1].s});
	vector<long double> ans(n+2); ans[1]=(long double)v[1].s;
	for(int i=2;i<=n;i++){
		pii node = st.top();
		long double sol = (long double)epow(v[i].f-v[node.f].f,2);
		sol/= 4; sol/=ans[node.f];
		ans[i]=min((long double)v[i].s,sol);
		while(st.size() && (long double)v[node.f].f+node.s < v[i].f+ans[i]) st.pop();
	}

//	for(int i=1;i<=n;i++) cout << ans[i] << setprecision(4) << endl;
	for(int i=1;i<=n;i++) printf("%.3Lf\n",ans[i]);

    return;
 	
}	


int32_t main() {
//	freopen("walk.in", "r", stdin);
//	freopen("walk.out", "w", stdout);
	ios_base::sync_with_stdio(0);cin.tie(0);   

    int t=1;
 //   cin >> t;
    while (t--) solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1.0690000000', error = '252735384.3689999878'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1884 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 4440 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 8284 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 9560 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 23 ms 12624 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 15952 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -