Submission #494436

# Submission time Handle Problem Language Result Execution time Memory
494436 2021-12-15T12:38:11 Z Christopher_ Jetpack (COCI16_jetpack) C++17
0 / 80
2 ms 2508 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int m;
  cin >> m;
  vector<string> g(10);
  for (int i = 0; i < 10; ++i) {
    cin >> g[i];
  }
  vector<int> ans;
  auto e = [&](int x, int y) {
    return x >= 0 && x < 10 && y >= 0 && y < m && g[x][y] != 'X';
  };
  function<bool(int,int)> Dfs = [&](int x, int y) {
    if (x == 0 || y == m - 1) {
      return true;
    }
    if (x == 9) {
      int nx = x, ny = y + 1;
      if (e(nx, ny)) {
        if (Dfs(nx, ny)) {
          return true;
        }
      }
      nx = x - 1, ny = y + 1;
      if (e(nx, ny)) {
        if (Dfs(nx, ny)) {
          ans.push_back(ny);
          return true;
        }
      }
    } else {
      int nx = x - 1, ny = y + 1;
      if (e(nx, ny)) {
        if (Dfs(nx, ny)) {
          ans.push_back(ny);
          return true;
        }
      }
      nx = x + 1, ny = y + 1;
      if (e(nx, ny)) {
        if (Dfs(nx, ny)) {
          return true;
        }
      }
    }
    return false;
  };
  if (Dfs(9, 0) == false) {
    cout << "0\n";
  }
  for (int i = (int) ans.size() - 1; ~i; --i) {
    cout << ans[i] << ' ' << 1 << '\n';
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 312 KB Unexpected end of file - int32 expected
2 Incorrect 0 ms 204 KB Moves are not sorted in chronological order.
3 Incorrect 0 ms 204 KB Moves are not sorted in chronological order.
4 Incorrect 1 ms 332 KB Unexpected end of file - int32 expected
5 Incorrect 1 ms 332 KB Unexpected end of file - int32 expected
6 Incorrect 1 ms 460 KB Unexpected end of file - int32 expected
7 Incorrect 1 ms 708 KB Unexpected end of file - int32 expected
8 Incorrect 1 ms 1356 KB Moves are not sorted in chronological order.
9 Incorrect 2 ms 1868 KB Moves are not sorted in chronological order.
10 Incorrect 2 ms 2508 KB Moves are not sorted in chronological order.