Submission #788976

# Submission time Handle Problem Language Result Execution time Memory
788976 2023-07-20T18:57:45 Z Ozy Boarding Passes (BOI22_passes) C++17
0 / 100
2 ms 340 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();

    if (n == 1 || n == 2) {
        cout << "0.000";
        return 0;
    }

    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 Incorrect 2 ms 340 KB Expected double, but "dp[i]" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Expected double, but "dp[i]" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Expected double, but "dp[i]" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Expected double, but "dp[i]" found
2 Halted 0 ms 0 KB -