제출 #1307875

#제출 시각아이디문제언어결과실행 시간메모리
1307875ssseulBalloons (CEOI11_bal)C++20
100 / 100
112 ms6628 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pii pair<int,int> #define all(a) a.begin(), a.end() #define el '\n' const int maxN = 2005; const int maxM = 205; const int base = 311; const int MOD = 1e9+7; const int INF = 1e18; const int NEG_INF = -1e18; const int MAX_DAYS = 1000; int dy[] = {-1, 1, 0, 0}; int dx[] = {0, 0, -1, 1}; int n, m, k, q, p, x, l; // string S, T; int S; int dist[maxN][maxN], min_dist[maxN][maxN]; int par[maxN], deg[maxN], color[maxN]; bool visited[maxN]; int yard[maxN]; vector<pii> g[maxN], g_per[maxN]; string grid[maxN]; struct Balloon { int id; double cord, rad; }; bool cmpBalloon(Balloon a, Balloon b){ return true; } // vector<Balloon> Balloons; double calcRad(double xi, double xj, double Rj){ return (xi - xj) * (xi - xj) / (4 * Rj); } void run_test() { cin >> n; vector<Balloon> Balloons(n+5); stack<Balloon> st; cout << fixed << setprecision(3); // R_i = (xi - xj) ^ 2 / (4 * Rj) for(int i = 1; i <= n; i++){ double xi, Ri; cin >> xi >> Ri; while(!st.empty()){ auto [id, xj, Rj] = st.top(); Ri = min(Ri, calcRad(xi, xj, Rj)); if(Ri >= Rj) st.pop(); else break; } st.push({i, xi, Ri}); cout << Ri << el; } } signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); // freopen("snowboots.in", "r", stdin); // freopen("snowboots.out", "w", stdout); int test = 1; // cin >> test; while (test-- > 0) { run_test(); } }
#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...