제출 #852239

#제출 시각아이디문제언어결과실행 시간메모리
852239parsadox2캥거루 (CEOI16_kangaroo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 5 , mod = 1e9 + 7; int n , s , t , dp[N][N] , ans; int modit(int a) { if(a >= mod) return a - mod; return a; } void solve(int st , int fn) { memset(dp , 0 , sizeof dp); dp[0][0] = 1; int slm = 0; for(int i = 1 ; i <= n ; i++) { if(i == s) { for(int j = 1 ; j <= n ; j++) dp[i][j] = dp[i - 1][j - st]; slm++; continue; } if(i == t) { for(int j = 1 ; j <= n ; j++) dp[i][j] = dp[i - 1][j - fn]; slm++; continue; } for(int j = 1 ; j <= n ; j++) { dp[i][j] = 1LL * dp[i - 1][j - 1] * max(0 , j - slm) % mod; dp[i][j] = modit(dp[i][j] + 1LL * dp[i - 1][j + 1] * j % mod); } } ans = modit(ans + dp[n][1]); } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> s >> t; int ty = (n & 1 ? 0 : 1); solve(1 , 1 ^ ty); solve(0 , 0 ^ ty); cout << ans << '\n'; return 0; }#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 5 , mod = 1e9 + 7; int n , s , t , dp[N][N] , ans; int modit(int a) { if(a >= mod) return a - mod; return a; } void solve(int st , int fn) { memset(dp , 0 , sizeof dp); dp[0][0] = 1; int slm = 0; for(int i = 1 ; i <= n ; i++) { if(i == s) { for(int j = 1 ; j <= n ; j++) dp[i][j] = dp[i - 1][j - st]; slm++; continue; } if(i == t) { for(int j = 1 ; j <= n ; j++) dp[i][j] = dp[i - 1][j - fn]; slm++; continue; } for(int j = 1 ; j <= n ; j++) { dp[i][j] = 1LL * dp[i - 1][j - 1] * max(0 , j - slm) % mod; dp[i][j] = modit(dp[i][j] + 1LL * dp[i - 1][j + 1] * j % mod); } } ans = modit(ans + dp[n][1]); } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> s >> t; int ty = (n & 1 ? 0 : 1); solve(1 , 1 ^ ty); solve(0 , 0 ^ ty); cout << ans << '\n'; return 0; }

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

kangaroo.cpp:55:2: error: stray '#' in program
   55 | }#include <bits/stdc++.h>
      |  ^
kangaroo.cpp:55:3: error: 'include' does not name a type
   55 | }#include <bits/stdc++.h>
      |   ^~~~~~~
kangaroo.cpp:59:11: error: redefinition of 'const int N'
   59 | const int N = 2e3 + 5 , mod = 1e9 + 7;
      |           ^
kangaroo.cpp:5:11: note: 'const int N' previously defined here
    5 | const int N = 2e3 + 5 , mod = 1e9 + 7;
      |           ^
kangaroo.cpp:59:25: error: redefinition of 'const int mod'
   59 | const int N = 2e3 + 5 , mod = 1e9 + 7;
      |                         ^~~
kangaroo.cpp:5:25: note: 'const int mod' previously defined here
    5 | const int N = 2e3 + 5 , mod = 1e9 + 7;
      |                         ^~~
kangaroo.cpp:60:5: error: redefinition of 'int n'
   60 | int n , s , t , dp[N][N] , ans;
      |     ^
kangaroo.cpp:6:5: note: 'int n' previously declared here
    6 | int n , s , t , dp[N][N] , ans;
      |     ^
kangaroo.cpp:60:9: error: redefinition of 'int s'
   60 | int n , s , t , dp[N][N] , ans;
      |         ^
kangaroo.cpp:6:9: note: 'int s' previously declared here
    6 | int n , s , t , dp[N][N] , ans;
      |         ^
kangaroo.cpp:60:13: error: redefinition of 'int t'
   60 | int n , s , t , dp[N][N] , ans;
      |             ^
kangaroo.cpp:6:13: note: 'int t' previously declared here
    6 | int n , s , t , dp[N][N] , ans;
      |             ^
kangaroo.cpp:60:17: error: redefinition of 'int dp [2005][2005]'
   60 | int n , s , t , dp[N][N] , ans;
      |                 ^~
kangaroo.cpp:6:17: note: 'int dp [2005][2005]' previously declared here
    6 | int n , s , t , dp[N][N] , ans;
      |                 ^~
kangaroo.cpp:60:28: error: redefinition of 'int ans'
   60 | int n , s , t , dp[N][N] , ans;
      |                            ^~~
kangaroo.cpp:6:28: note: 'int ans' previously declared here
    6 | int n , s , t , dp[N][N] , ans;
      |                            ^~~
kangaroo.cpp:62:5: error: redefinition of 'int modit(int)'
   62 | int modit(int a)
      |     ^~~~~
kangaroo.cpp:8:5: note: 'int modit(int)' previously defined here
    8 | int modit(int a)
      |     ^~~~~
kangaroo.cpp:69:6: error: redefinition of 'void solve(int, int)'
   69 | void solve(int st , int fn)
      |      ^~~~~
kangaroo.cpp:15:6: note: 'void solve(int, int)' previously defined here
   15 | void solve(int st , int fn)
      |      ^~~~~
kangaroo.cpp:99:8: error: redefinition of 'int main()'
   99 | signed main()
      |        ^~~~
kangaroo.cpp:45:8: note: 'int main()' previously defined here
   45 | signed main()
      |        ^~~~