Submission #788970

# Submission time Handle Problem Language Result Execution time Memory
788970 2023-07-20T18:51:01 Z Ozy Boarding Passes (BOI22_passes) C++17
0 / 100
1 ms 212 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define debug(a) cout << #a << " = " << fixed << setprecision(1) << a << endl
#define debugsl(a) cout << #a << " = " << fixed << setprecision(1) << a << ", "
#define rep(i,a,b) for(int i = (a); i<=(b); i++)
#define repa(i,a,b) for(int i = (a); i>=(b); i--)
#define pll pair<lli,lli>

#define MAX 100000

lli n,k;
long double dp[MAX+2],res,a;
string st;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> st;
    n = st.size();

    res = -1;
    rep(i,2,n) {

        a = (i-1);
        a /= 2;
        dp[i] = dp[i-1] + a;

        k = n-i;
        if (k <= i) {
            a = dp[k] + dp[i];
            if (res < 0 || a < res) res = a;
        }
    }
    //rep(i,1,n) debug(dp[i]);

    cout << fixed << setprecision(3) << res;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB found '100800.5000000000', expected '100800.5000000000', error '0.0000000000'
2 Incorrect 1 ms 212 KB 1st numbers differ - expected: '0.0000000000', found: '-1.0000000000', error = '1.0000000000'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st numbers differ - expected: '1.0000000000', found: '3.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st numbers differ - expected: '1.0000000000', found: '3.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB found '100800.5000000000', expected '100800.5000000000', error '0.0000000000'
2 Incorrect 1 ms 212 KB 1st numbers differ - expected: '0.0000000000', found: '-1.0000000000', error = '1.0000000000'
3 Halted 0 ms 0 KB -