Submission #1242451

#TimeUsernameProblemLanguageResultExecution timeMemory
1242451hssaan_arifKangaroo (CEOI16_kangaroo)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

#define endl "\n"
#define pb push_back
#define int long long

const int N = 2e3 + 5, M = 1e9 + 7 , LG = 20;

int n , dp[N][N][3] , s , t;

void solve(){
    cin >> n >> s >> t;
    if (s == 1 || t == 1){
        dp[1][1][1] = 1;
    }else{
        dp[1][1][0] = 1;
    }
    for (int i = 1 ; i <= n ; i++){
        for (int j = 1 ; j <= i ; j++){
            if (i + 1 == s || i + 1 == t){
                for (int k=0;k<2;k++){
                    dp[i+1][j+1][k+1] += dp[i][j][k];
                    dp[i+1][j][k+1] += dp[i][j][k];
                    dp[i+1][j+1][k+1] %= M;
                    dp[i+1][j][k+1] %= M;
                    continue;
                }
                continue;
            }
            for (int k=0;k<3;k++){
                dp[i+1][j + 1][k] += dp[i][j][k] * (j + 1 - k);
                // dp[i+1][j] += dp[i][j] * 2 * j;
                dp[i+1][j - 1][k] += dp[i][j][k] * (j - 1);
                dp[i+1][j+1][k] %= M;
                dp[i+1][j-1][k] %= M;
            }
            
        }
    }
    cout << dp[n][1][2]%M << endl;
}

signed main(){
    freopen("kangaroo.in" , "r" , stind);
    freopen("kangaroo.out" , "w" , stdout);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int ts = 1;
    // cin >> ts;
    while(ts--){
        solve();
    }
}

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:45:35: error: 'stind' was not declared in this scope
   45 |     freopen("kangaroo.in" , "r" , stind);
      |                                   ^~~~~
kangaroo.cpp:46:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |     freopen("kangaroo.out" , "w" , stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~