답안 #78467

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
78467 2018-10-05T11:55:39 Z Saboon Fibonacci representations (CEOI18_fib) C++14
0 / 100
367 ms 263168 KB
#include <iostream>
#include <queue>
#include <stack>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <cmath>
#include <cassert>
#include <unordered_set>
#include <map>
#include <deque>
#include <unordered_map>
#include <fstream>
#include <set>
#include <algorithm>
#include <iomanip>
#define fin cin
#define fout cout
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef unsigned long long ull;

const int maxn = 1e6 + 10;

ll dp[maxn][100], f[100];

int main () {
    ios_base::sync_with_stdio(false);
    f[1] = 1;
    f[2] = 2;
    for (int i = 3; i <= 50; i++)
        f[i] = f[i - 1] + f[i - 2];
    for (int i = 0; i <= 50; i++) {
        dp[1][i] = 1;
        dp[0][i] = 1;
    }
    dp[1][0] = 0;
    for (int i = 2; i < int (1e6); i++) {
        for (int j = 1; j <= 50; j++) {
            dp[i][j] = dp[i][j - 1];
            if (f[j] <= i) {
                dp[i][j] += dp[i - f[j]][j - 1];
            }
        }
    }
    int n;
    cin >> n;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        sum += f[x];
        cout << dp[sum][50] << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 347 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 347 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 367 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 347 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 364 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 347 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -