Submission #527193

#TimeUsernameProblemLanguageResultExecution timeMemory
527193Hydroxic_AcidCalvinball championship (CEOI15_teams)C++17
10 / 100
1092 ms972 KiB
#include <iostream> #include <cstring> using namespace std; int N; int arr[10005]; int dp(int idx, int num, int marker){ if(idx >= N) return 0; if(idx == N - 1) return 1; if(num > N) return 0; int summ = 0; for(int i = 1; i <= num + 1; i++){ if(marker){ if(i == arr[idx + 1])summ += dp(idx + 1, i, 1); else if (i < arr[idx + 1])summ += dp(idx + 1, i, 0); else break; } else if(i == num + 1) summ += dp(idx + 1, num + 1, 0); else summ += dp(idx + 1, num, 0); summ %= 1000007; } return summ; } int main(){ cin >> N; for(int i = 0; i < N; i++) cin >> arr[i]; cout << dp(0, 1, 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...