제출 #49343

#제출 시각아이디문제언어결과실행 시간메모리
493433zp캥거루 (CEOI16_kangaroo)C++14
6 / 100
4 ms1208 KiB
#include<bits/stdc++.h> using namespace std; int dp[2][2009][2009][3]; int prefdp[2][2009][2009][3]; int mod = 1e9+ 7; main(){ int n,l,r; cin >> n >> l >> r; dp[1][1][1][1] = 1; dp[1][1][1][0] = 1; prefdp[1][1][1][1] = 1; prefdp[1][1][1][0] = 1; for(int N = 2; N <= n; N++){ int n0 = N % 2, n1 = 1 - n0; for(int L = 1; L <= n; L++){ for(int R = r - (n- N); R <= r; R++){ for(int D = 0; D < 2; D++){ if(L != R){ int nR = R; if (R > L) nR--; if(D == 0){ dp[n0][L][R][D] += prefdp[n1][N-1][nR][1-D] - prefdp[n1][L-1][nR][1-D] + mod; while (dp[n0][L][R][D] >= mod) dp[n0][L][R][D]-=mod; } else { dp[n0][L][R][D] += prefdp[n1][L-1][nR][1-D]; while (dp[n0][L][R][D] >= mod) dp[n0][L][R][D]-=mod; } } prefdp[n0][L][R][D] = prefdp[n0][L-1][R][D] + dp[n0][L][R][D]; if( prefdp[n0][L][R][D] >= mod) prefdp[n0][L][R][D] -= mod; } } } } cout << (dp[n%2][l][r][0] + dp[n%2][l][r][1]) % mod << endl; }

컴파일 시 표준 에러 (stderr) 메시지

kangaroo.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...