제출 #875027

#제출 시각아이디문제언어결과실행 시간메모리
875027dilanyan힘 센 거북 (IZhO11_turtle)C++17
40 / 100
181 ms197348 KiB
//-------------dilanyan------------\\ 
 
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;

//------------------KarginDefines--------------------\\ 

#define ll long long
#define pb push_back
#define all(u) (u).begin(), (u).end()
#define pqueue priority_queue
#define upper upper_bound
#define lower lower_bound
#define umap unordered_map
#define uset unordered_set
#define Kargin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Usaco freopen(".in", "r", stdin); freopen(".out", "w", stdout);


//-------------------KarginConstants------------------\\ 
 
const int mod = 1000000007;
const ll inf = 1e9;

//-------------------KarginCode------------------------\\ 
 
const int N = 1005;
bool a[N][N];
ll dp[N][N][25];

void KarginSolve() {
    ll n, m, k, t, z;
    cin >> n >> m >> k >> t >> z;
    for (int i = 0;i < k;i++) {
        int x, y;
        cin >> x >> y;
        a[x][y] = true;
    }
    dp[0][0][0] = 1;
    for (int b = 0;b <= k;b++) {
        for (int i = 0;i <= n;i++) {
            for (int j = 0;j <= n;j++) {
                if (!i && !j) continue;
                if (a[i][j]) {
                    if(!b) continue;
                    if (i > 0) dp[i][j][b] += dp[i - 1][j][b - 1];
                    if (j > 0) dp[i][j][b] += dp[i][j - 1][b - 1];
                }
                else {
                    if (i > 0) dp[i][j][b] += dp[i - 1][j][b];
                    if (j > 0) dp[i][j][b] += dp[i][j - 1][b];
                }
                dp[i][j][b] %= z;
            }
        }
    }
    ll ans = 0;
    for (int i = 0;i <= t;i++) {
        ans += dp[n][m][i];
        ans %= z;
    }
    cout << ans << '\n';
}

int main() {
    //Usaco
    Kargin;
    int test = 1;
    //cin >> test;
    while (test--) {
        KarginSolve();
    }
    return 0;
}

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

turtle.cpp:1:1: warning: multi-line comment [-Wcomment]
    1 | //-------------dilanyan------------\\
      | ^
turtle.cpp:8:1: warning: multi-line comment [-Wcomment]
    8 | //------------------KarginDefines--------------------\\
      | ^
turtle.cpp:22:1: warning: multi-line comment [-Wcomment]
   22 | //-------------------KarginConstants------------------\\
      | ^
turtle.cpp:27:1: warning: multi-line comment [-Wcomment]
   27 | //-------------------KarginCode------------------------\\
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...