# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1101903 | 2024-10-17T07:22:32 Z | InvMOD | Balloons (CEOI11_bal) | C++14 | 133 ms | 14940 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define gcd __gcd #define vsz(v) (int) v.size() #define pb push_back #define pi pair<int,int> #define all(v) (v).begin(), (v).end() #define compact(v) (v).erase(unique(all(v)), (v).end()) #define FOR(i, a, b) for(int i = (a); i <= (b); i++) ///#define int long long using ll = long long; using ld = long double; using ull = unsigned long long; template<typename T> bool ckmx(T& a, const T& b){if(a < b) return a = b, true; return false;} template<typename T> bool ckmn(T& a, const T& b){if(a > b) return a = b, true; return false;} const int N = 2e5+5; const ll MOD = 1e9+7; const ld inf = 1e18; ld square(ld x){ return (x * x); } int n; ld x[N], r[N]; ld radius[N]; ld calc_dist(ld x1, ld r1, ld x2){ ld r2 = square(x1 - x2) / (4* r1); return r2; } void solve() { cin >> n; for(int i = 1; i <= n; i++){ cin >> x[i] >> r[i]; } stack<int> st; for(int i = 1; i <= n; i++){ ld cur_rad = r[i]; while(!st.empty()){ int j = st.top(); cur_rad = min(cur_rad, calc_dist(x[j], radius[j], x[i])); if(cur_rad >= radius[j]){ st.pop(); } else{ break; } } radius[i] = cur_rad; st.push(i); } for(int i = 1; i <= n; i++){ cout << fixed << setprecision(3) << radius[i] <<"\n"; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define name "InvMOD" if(fopen(name".INP", "r")){ freopen(name".INP","r",stdin); freopen(name".OUT","w",stdout); } int t = 1; //cin >> t; while(t--) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4432 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4432 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4432 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 8940 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 9288 KB | 50000 numbers |
2 | Correct | 35 ms | 10068 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 9660 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 78 ms | 9800 KB | 115362 numbers |
2 | Correct | 72 ms | 11864 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 102 ms | 10312 KB | 154271 numbers |
2 | Correct | 124 ms | 14940 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 133 ms | 11236 KB | 200000 numbers |
2 | Correct | 119 ms | 14924 KB | 199945 numbers |