Submission #160588

#TimeUsernameProblemLanguageResultExecution timeMemory
160588AkashiKangaroo (CEOI16_kangaroo)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int n, l, r; int d[2005][2005]; int main() { // freopen("kangaroo.in", "r", stdin); // freopen("kangaroo.out", "w", stdout); scanf("%d%d%d", &n, &l, &r); d[0][0] = 1; for(int i = 1; i <= n ; ++i){ if(i != l && i != r){ ///create a new component for(int k = 1; k <= i ; ++k) d[i][k] = (d[i][k] + 1LL * d[i - 1][k - 1] * k) % MOD; ///merge two components for(int k = 1; k <= i ; ++k) d[i][k] = (d[i][k] + 1LL * d[i - 1][k + 1] * k) % MOD; } else{ for(int k = 1; k <= i ; ++k){ d[i][k] = d[i - 1][k - 1] + d[i - 1][k]; if(d[i][k] >= MOD) d[i][k] -= MOD; } } } printf("%d", d[n][1]); return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &l, &r);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...