Submission #163338

#TimeUsernameProblemLanguageResultExecution timeMemory
163338ryanseeKangaroo (CEOI16_kangaroo)C++14
51 / 100
117 ms76680 KiB
#include <cstdio> #include <iostream> #define MOD 1000000007 using namespace std; int c[210][210][210] , d[210][210][210]; int main() { FILE *fin = stdin; FILE *fout = stdout; int n , cs , cf , len , bgn , ed; fscanf (fin,"%d%d%d",&n,&cs,&cf); c[2][1][2] = d[2][2][1] = 1; for (len = 3 ; len <= n ; len++){ for (bgn = 1 ; bgn <= len ; bgn++){ for (ed = bgn + 1 ; ed <= len ; ed ++){ if (bgn!=1) c[len][bgn][ed] = ((c[len][bgn-1][ed] - d[len-1][bgn-1][ed-1])%MOD + MOD )%MOD; else { for (int bgn2 = bgn+1 ; bgn2 <= len ; bgn2++) c[len][bgn][ed] = (c[len][bgn][ed] + d[len-1][bgn2][ed-1])%MOD; } d[len][bgn][ed] = (d[len][bgn-1][ed] + c[len-1][bgn-1][ed-1])%MOD; if (len%2 == 1){ d[len][ed][bgn] = d[len][bgn][ed]; c[len][ed][bgn] = c[len][bgn][ed]; } else { d[len][ed][bgn] = c[len][bgn][ed]; c[len][ed][bgn] = d[len][bgn][ed]; } } } } fprintf (fout,"%d",(c[n][cs][cf] + d[n][cs][cf])%MOD); return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:11:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     fscanf (fin,"%d%d%d",&n,&cs,&cf);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...