Submission #527154

#TimeUsernameProblemLanguageResultExecution timeMemory
527154Hydroxic_AcidCalvinball championship (CEOI15_teams)C++17
0 / 100
37 ms65540 KiB
#include <iostream> #include <cstring> using namespace std; int N; int arr[10005]; int memo[10005][10005]; int dp(int idx, int num){ if(idx == N - 1) return 1; if(memo[idx][num] != -1) return memo[idx][num]; int summ = 0; for(int i = 1; i <= min(arr[idx + 1], num + 1); i++){ if(i == num + 1) summ += dp(idx + 1, num + 1); else summ += dp(idx + 1, num); summ %= 1000007; } return memo[idx][num] = summ; } int main(){ cin >> N; for(int i = 0; i < N; i++) cin >> arr[i]; memset(memo, -1, sizeof(memo)); cout << dp(0, 1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...