Submission #1299719

#TimeUsernameProblemLanguageResultExecution timeMemory
1299719tabJetpack (COCI16_jetpack)C++20
0 / 80
42 ms8248 KiB
#include "bits/stdc++.h"
using namespace std;
#define intt long long
#define fi first
#define se second

const intt mxN = 2e5 + 5;
const intt LG = 20;
const intt inf = 1e18;  

intt n;
char g[10][mxN];

vector <intt> v;
bool dfs (intt x, intt y) {
  if (g[x][y] == 'X') return 0;
  if (y == n-1) return 1;
  g[x][y] = 'X';
  intt nx = min(9ll, x+1), ny = y + 1;
  if(dfs(nx, ny)) {
    return 1;
  }
  nx = max(0ll, x-1), ny = y + 1;
  if(dfs(nx, ny)) {
    v.push_back(y);
    return 1;
  }
  return 0;

}

void _() {
    cin >> n;
    for(intt i = 0; i < 10; i++) {
        for(intt j = 0; j < n; j++) {
            cin >> g[i][j];
        }
    }
    dfs(9,0);
    reverse(v.begin(), v.end());
    for(auto u : v) {
        cout << u << " " << 1 << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    intt t = 1, buu = 1;
    // cin >> t;
    while(t--){
        // cout << "Case #" << buu++ << ": ";
        _();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...