#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {-1, 0, 1, 0};

inline bool inBoard(int x, int y) {
    return (x >= 0 && x < 9 && y >= 0 && y < 9);
}

inline int toMid(int z) {
    if (z < 4) return 1;
    else return -1;
}

int t;
int X1, Y1, T1;
int X2, Y2, T2;
int c[9][9];

int main() {
    cin >> t;
    cin >> X1 >> Y1 >> T1;
    cin >> X2 >> Y2 >> T2;
    rep(i,9) rep(j,9) cin >> c[i][j];
    int dir = 0;
    int val = -1;
    rep(i,4) {
        if (!inBoard(X1+dx[i], Y1+dy[i])) continue;
    
        int tmp = c[X1+dx[i]][Y1+dy[i]];
        if (tmp == 0) {
            if (val < 0) {
                val = 0;
                dir = i+1;
            }
        } else if (tmp == 2) {
            if (val < 1) {
                val = 1;
                dir = i+1;
            }
        } 
    }
    cout << dir << endl;
}






























Battle History

OpponentConfigResultDate
BOT (random)Lose2018/05/19 14:24:07
@kuromunori (#7)Lose2018/05/19 14:24:34