답안 #332077

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
332077 2020-12-01T11:36:04 Z Valera_Grinenko Jump (BOI06_jump) C++17
70 / 100
2 ms 496 KB
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  //https://codeforces.com/blog/entry/76307?locale=en
  //random OI problem 1.12.2020

  ll n = 0;

  cin >> n;

  vector<vector<ll> > dp(n, vector<ll>(n));

  dp[0][0] = 1;

  for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++) {
      int d; cin >> d;
      if(!d) continue;
      if(i + d < n) dp[i + d][j] += dp[i][j];
      if(j + d < n) dp[i][j + d] += dp[i][j];
    }

  cout << dp[n - 1][n - 1];

  return 0;
}
/*

*/

Compilation message

jump.cpp:3: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 496 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Incorrect 1 ms 364 KB Output isn't correct
17 Incorrect 1 ms 364 KB Output isn't correct
18 Incorrect 1 ms 364 KB Output isn't correct
19 Incorrect 2 ms 364 KB Output isn't correct
20 Incorrect 1 ms 492 KB Output isn't correct