Submission #96885

#TimeUsernameProblemLanguageResultExecution timeMemory
96885Kastanda캥거루 (CEOI16_kangaroo)C++11
36 / 100
2037 ms1096 KiB
// I do it for the glory #include<bits/stdc++.h> using namespace std; const int N = 205, Mod = 1e9 + 7; int dp[2][N][N][2]; inline int MOD(int a) { if (a >= Mod) a -= Mod; if (a < 0) a += Mod; return a; } int main() { int n, s, f; scanf("%d%d%d", &n, &s, &f); dp[0][1][2][0] = dp[0][2][1][1] = 1; for (int i = 3; i <= n; i ++) { bool w = i & 1; for (int st = 1; st <= i; st ++) for (int fn = 1; fn <= i; fn ++) if (fn != st) { dp[w][st][fn][0] = dp[w][st][fn][1] = 0; // 0 : for (int h = st + 1; h <= i; h ++) if (h != fn) dp[w][st][fn][0] = MOD(dp[!w][h-1][fn - (st < fn)][1] + dp[w][st][fn][0]); // 1 : for (int h = 1; h < st; h ++) if (h != fn) dp[w][st][fn][1] = MOD(dp[!w][h][fn - (st < fn)][0] + dp[w][st][fn][1]); } } return !printf("%d\n", MOD(dp[n & 1][s][f][0] + dp[n & 1][s][f][1])); }

Compilation message (stderr)

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