# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
891235 |
2023-12-22T14:32:24 Z |
fragadmsc |
Balloons (CEOI11_bal) |
C++17 |
|
416 ms |
14888 KB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> pii;
typedef long long ll;
typedef long double ld;
const long long MAXLOG = 23;
const long long MAXN = 1e3+5; // use com cuidado
const long long MOD = 998244353;
const long long inf = 1e9 + 10;
const long long TWO_MOD_INV = 500000004;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define KAMEKAMEHA ios_base::sync_with_stdio(0); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sz(x) (int)x.size()
int main() {
KAMEKAMEHA
#ifdef FRAGA
//freopen("output.out", "w", stdout);
freopen("err.er", "w", stderr);
#endif
#ifndef FRAGA
//freopen("cbarn2.in", "r", stdin);
//freopen("cbarn2.out", "w", stdout);
#endif
ll n;
cin>>n;
vector<pair<ld, ld>> vet(n+2);
for(ll i=1;i<=n;i++) {
cin>>vet[i].f>>vet[i].s;
}
vet[0]={-1e9, 1e9};
stack<ll> st;
st.push(0);
vector<ld> rad(n+5);
ll ult;
for(ll i=1;i<=n;i++) {
ult=false;
ll aux;
while(true) {
//n bateu
if(vet[i].s<(vet[i].f-vet[st.top()].f)*(vet[i].f-vet[st.top()].f)/(4.0*vet[st.top()].s)) {
if(vet[i].s<vet[st.top()].s) {// n bateu e eh menor, ja pode encerrar
rad[i]=vet[i].s;
st.push(i);
break;
} else { //n bateu mas e maior, elimina o ult e continua
st.pop();
}
} else { //bateu
//muda pra um raio menor e ve se vai ter um pra deixar o raio menor ainda
vet[i].s=(vet[i].f-vet[st.top()].f)*(vet[i].f-vet[st.top()].f)/(4.0*vet[st.top()].s);
st.pop();
}
}
}
for(ll i=1;i<=n;i++) {
cout<<fixed<<setprecision(6)<<rad[i]<<endl;
}
cout<<endl;
}
Compilation message
bal.cpp: In function 'int main()':
bal.cpp:44:12: warning: unused variable 'aux' [-Wunused-variable]
44 | ll aux;
| ^~~
bal.cpp:41:8: warning: variable 'ult' set but not used [-Wunused-but-set-variable]
41 | ll ult;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
604 KB |
148th numbers differ - expected: '8.2380000000', found: '26.0000000000', error = '17.7620000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
1852 KB |
196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
3924 KB |
13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
203 ms |
7708 KB |
7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
238 ms |
9044 KB |
4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
352 ms |
11604 KB |
1730th numbers differ - expected: '5.6890000000', found: '6.8055560000', error = '1.1165560000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
416 ms |
14888 KB |
2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000' |
2 |
Halted |
0 ms |
0 KB |
- |