답안 #198871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198871 2020-01-27T22:51:42 Z imaxblue Jump (BOI06_jump) C++17
0 / 100
8 ms 1452 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vp3i vector<p3i>
#define vpll vector<pll>
#define vp3l vector<p3l>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() ((rand() << 14)+rand())
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846
#define startrng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, a[105][105];
ll dp[105][105][14];
int32_t main(){
  scanf("%i", &n);
  dp[0][0][0]=1;
  fox(l, n){
    fox(l2, n){
      fox(l3, 12){
        dp[l][l2][l3+1] += dp[l][l2][l3]/1000000000;
        dp[l][l2][l3] %= 1000000000;
      }
      if (l==n-1 && l2==n-1) break;
      scanf("%i", &a[l][l2]);
      fox(l3, 12){
        if (l+a[l][l2]<n) dp[l+a[l][l2]][l2][l3] += dp[l][l2][l3];
        if (l2+a[l][l2]<n) dp[l][l2+a[l][l2]][l3] += dp[l][l2][l3];
      }
      //cout << dp[l][l2] << ' ';
    }
    //cout << endl;
  }
  fox(l, 5)
  dp[n-1][n-1][l] =1;
  foxr(l, 12){
    if (dp[n-1][n-1][l]==0 && l!=0) continue;
    if (dp[n-1][n-1][l+1]){
      printf("%09i", dp[n-1][n-1][l]);
      dp[n-1][n-1][l]=1;
      continue;
    }
    cout << dp[n-1][n-1][l];
  }
  return 0;
}
/*
4
2 3 3 1
1 2 1 3
1 2 3 1
3 1 1 0
*/

Compilation message

jump.cpp: In function 'int32_t main()':
jump.cpp:62:37: warning: format '%i' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
       printf("%09i", dp[n-1][n-1][l]);
                      ~~~~~~~~~~~~~~~^
jump.cpp:39:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%i", &n);
   ~~~~~^~~~~~~~~~
jump.cpp:48:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%i", &a[l][l2]);
       ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Incorrect 6 ms 376 KB Output isn't correct
3 Incorrect 5 ms 376 KB Output isn't correct
4 Incorrect 5 ms 376 KB Output isn't correct
5 Incorrect 5 ms 376 KB Output isn't correct
6 Incorrect 5 ms 376 KB Output isn't correct
7 Incorrect 5 ms 504 KB Output isn't correct
8 Incorrect 5 ms 504 KB Output isn't correct
9 Incorrect 5 ms 504 KB Output isn't correct
10 Incorrect 5 ms 380 KB Output isn't correct
11 Incorrect 5 ms 504 KB Output isn't correct
12 Incorrect 6 ms 504 KB Output isn't correct
13 Incorrect 5 ms 680 KB Output isn't correct
14 Incorrect 5 ms 632 KB Output isn't correct
15 Incorrect 6 ms 1016 KB Output isn't correct
16 Incorrect 7 ms 1272 KB Output isn't correct
17 Incorrect 7 ms 1276 KB Output isn't correct
18 Incorrect 7 ms 1400 KB Output isn't correct
19 Incorrect 7 ms 1400 KB Output isn't correct
20 Incorrect 8 ms 1452 KB Output isn't correct