Submission #605081

# Submission time Handle Problem Language Result Execution time Memory
605081 2022-07-25T12:48:03 Z krit3379 Balloons (CEOI11_bal) C++17
100 / 100
141 ms 5420 KB
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define N 200005

long double x,r;
stack<pair<long double,long double>> st;

int main(){
    int n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    for(i=1;i<=n;i++){
        scanf("%Lf %Lf",&x,&r);
        while(!st.empty()){
            auto [x1,r1]=st.top();
            r=min(r,(x-x1)*(x-x1)/4/r1);
            if(r>=r1)st.pop();
            else break;
        }
        st.push({x,r});
        printf("%.3Lf\n",r);
    }
    return 0;
}

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
bal.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%Lf %Lf",&x,&r);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 15 ms 596 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1692 KB 50000 numbers
2 Correct 31 ms 1588 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 75 ms 2828 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 92 ms 3404 KB 115362 numbers
2 Correct 80 ms 3324 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 116 ms 4116 KB 154271 numbers
2 Correct 129 ms 5420 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 139 ms 4644 KB 200000 numbers
2 Correct 141 ms 5376 KB 199945 numbers