Submission #444170

# Submission time Handle Problem Language Result Execution time Memory
444170 2021-07-13T08:48:32 Z Haruto810198 Fibonacci representations (CEOI18_fib) C++17
15 / 100
4000 ms 204 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define double long double

#define FOR(i, l, r, d) for(int i=(l); i<=(r); i+=(d))
#define szof(x) ((int)(x).size())

#define vi vector<int>
#define pii pair<int, int>

#define F first
#define S second

#define pb push_back
#define eb emplace_back
#define mkp make_pair

const int INF = 2147483647;
const int LNF = INF*INF;
const int MOD = 1000000007;
const int mod = 998244353;

const int MAX = 110;

int n;
int id[MAX];
vi arr;

int dp[MAX][2];
int res[MAX];

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    FOR(i, 0, n-1, 1){
        cin>>id[i];
    }

    FOR(i, 0, n-1, 1){

        arr.pb(id[i]);
        sort(arr.begin(), arr.end());

        dp[0][0] = 1;
        dp[0][1] = (arr[0] - 1) / 2;

        FOR(j, 1, i, 1){
            dp[j][0] = (dp[j-1][0] + dp[j-1][1]) % MOD;
            dp[j][1] = (dp[j-1][0] * ((arr[j] - arr[j-1] - 1) / 2) + dp[j-1][1] * ((arr[j] - arr[j-1]) / 2)) % MOD;
        }

        res[i] = (dp[i][0] + dp[i][1]) % MOD;

    }

    FOR(i, 0, n-1, 1){
        cout<<res[i]<<" ";
    }
    cout<<'\n';

    return 0;

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4040 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -