(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #129373

#TimeUsernameProblemLanguageResultExecution timeMemory
129373DodgeBallManKangaroo (CEOI16_kangaroo)C++14
100 / 100
101 ms32248 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 10; const int mod = 1e9 + 7; int n, s, e; long long dp[N][N]; long long solve( int i, int j ) { if( dp[i][j] != -1 ) return dp[i][j]; if( j == 0 ) return dp[i][j] = 0; if( i == 1 ) return dp[i][j] = j == 1 ? 1 : 0; if( i == s || i == e ) return dp[i][j] = ( solve( i-1, j-1 ) + solve( i-1, j ) ) % mod; return dp[i][j] = ( solve( i-1, j+1 ) * j + solve( i-1, j-1 ) * ( j - ( i > s ? 1 : 0 ) - ( i > e ? 1 : 0 ) ) ) % mod; } int main() { memset( dp, -1, sizeof dp ); scanf("%d %d %d",&n,&s,&e); printf("%lld",solve( n, 1 )); return 0; }

Compilation message (stderr)

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