Submission #6345678


Source Code Expand

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

ll K,N;

vector<ll> memo(100100100,-1);

ll dp( ll a){
  if( a < 0){ return 0;}
  if( memo[a] != -1){ return memo[a];}
  
  ll res = 0;
  for(ll i = 0; i < K; i++){
    res += dp(a-i); res %= MOD;}
  
  return memo[a] = res % MOD;}

int main(){
  cin >> K >> N;
  for(int i = 0; i < K; i++){
    memo[i] = 1;}
  cout << dp(N) << endl;
  return 0;}

Submission Info

Submission Time
Task T - フィボナッチ
User youyin
Language C++14 (GCC 5.4.1)
Score 0
Code Size 540 Byte
Status RE
Exec Time 413 ms
Memory 1044352 KB

Judge Result

Set Name All
Score / Max Score 0 / 8
Status
MLE × 1
RE × 6
Set Name Test Cases
All 00, 01, 02, 03, 04, 90, 91
Case Name Status Exec Time Memory
00 RE 343 ms 782208 KB
01 RE 289 ms 782336 KB
02 RE 289 ms 782208 KB
03 RE 289 ms 782208 KB
04 MLE 194 ms 782336 KB
90 RE 413 ms 1044352 KB
91 RE 413 ms 1044352 KB