답안 #479243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
479243 2021-10-11T01:27:22 Z Neos Jetpack (COCI16_jetpack) C++14
0 / 80
32 ms 9932 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;
 
#define task "test"
#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i, l, r) for( ll i = (l) ; i < (r) ; i++ )
#define forb(i, r, l) for( ll i = (r) ; i >= (l) ; i-- )
#define sz(x) (int)x.size()
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define numBit(x) __builtin_popcount(x)
#define lb lower_bound
#define ub upper_bound
#define ar array
#define endl '\n'
 
const int dx[3] = {0, -1, 1};
const int dy[3] = {1, 1, -1};
 
const int N = 2e5 + 7;
const ll inf = 0x3f3f3f3f;

int n, a[11][N];
bool vis[11][N];
vi tr;

bool dfs(int i, int j) {
  if (vis[i][j] || a[i][j]) return 0;
  if (j == n) return 1;
  vis[i][j] = 1;  

  if (dfs(min(i + 1, 10), j + 1)) return 1;
  if (dfs(max(i - 1, 1), j + 1)) {
    tr.push_back(j);
    return 1;
  }
  return 0;
}

int main() {
  fastIO;

  cin >> n;
  forw(i, 1, 11) forw(j, 1, n + 1) {
    char c; cin >> c;
    if (c == 'X') a[i][j] = 1;
  }

  dfs(10, 1);

  reverse(all(tr));
  cout << sz(tr) << endl;
  for (auto it: tr) cout << it << " 1" << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB Crashed with an obstacle
2 Incorrect 1 ms 332 KB Crashed with an obstacle
3 Incorrect 1 ms 332 KB Crashed with an obstacle
4 Incorrect 1 ms 456 KB Crashed with an obstacle
5 Incorrect 2 ms 716 KB Crashed with an obstacle
6 Incorrect 2 ms 896 KB Crashed with an obstacle
7 Incorrect 6 ms 2124 KB Crashed with an obstacle
8 Incorrect 14 ms 4832 KB Crashed with an obstacle
9 Incorrect 21 ms 7280 KB Crashed with an obstacle
10 Incorrect 32 ms 9932 KB Crashed with an obstacle