Submission #1317676

#TimeUsernameProblemLanguageResultExecution timeMemory
1317676eyadoozJump (BOI06_jump)C++20
70 / 100
1 ms332 KiB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'
#define int long long

main()
{
    cin.tie(0) -> sync_with_stdio(0);

    int n;
    cin >> n;
    int dp[n][n]={};
    dp[0][0]=1;
    for(int i = 0;i < n;i++) 
    {
        for(int j = 0;j < n;j++) 
        {
            int x;
            cin >> x;
            if(i==n-1&&j==n-1) break;
            // cout << i << " " << j << " " << dp[i][j] << endl;
            if(i+x<n) dp[i+x][j]+=dp[i][j];
            if(j+x<n) dp[i][j+x]+=dp[i][j];
        }
    }
    cout << dp[n-1][n-1];
}
    

Compilation message (stderr)

jump.cpp:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   14 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...