Submission #6345684


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 = 1; i <= K; i++){
    res += dp(a-i); res %= MOD;}
  
  return memo[a] = res % MOD;}

int main(){
  cin >> K >> N;
  for(ll 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 350 ms
Memory 782336 KB

Judge Result

Set Name All
Score / Max Score 0 / 8
Status
MLE × 3
RE × 4
Set Name Test Cases
All 00, 01, 02, 03, 04, 90, 91
Case Name Status Exec Time Memory
00 RE 350 ms 782208 KB
01 RE 304 ms 782336 KB
02 RE 289 ms 782208 KB
03 RE 289 ms 782336 KB
04 MLE 193 ms 782336 KB
90 MLE 194 ms 782336 KB
91 MLE 193 ms 782336 KB