// メインの処理は100行ぐらい下のsolve関数にあります

#include <bits/stdc++.h>
using namespace std;
#define int long long

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int i##0_to = (t), i = (f); i <= i##0_to; i++)
#define uptil(f, t, i)   for(int i##0_to = (t), i = (f); i <  i##0_to; i++)
#define downto(f, t, i)  for(int i##0_to = (t), i = (f); i >= i##0_to; i--)
#define downtil(f, t, i) for(int i##0_to = (t), i = (f); i >  i##0_to; i--)

#ifdef DEBUG
    #define _GLIBCXX_DEBUG
    #define _LIBCPP_DEBUG 2
    #define _LIBCPP_DEBUG2 2
#endif
#define ln << '\n'
#define tb << '\t'
#define sp << ' '
#define DD(x) if(debug) cerr << #x << " = " << (x) << ", "
#define DDD(x) if(debug) cerr << #x << " = " << (x) ln
#define db dd
#define dbg ddd

void solve();

signed main(signed argc, char *argv[]) {
    #ifndef DEBUG
        cin.tie(0);
        ios::sync_with_stdio(0);
    #endif
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(20);

    solve();

    return 0;
}

/******************************* basic library ********************************/
    #define firstItrSTValGE lower_bound
    #define firstItrSTValGT upper_bound
    #define MP make_pair
    #define MT make_tuple
    #define PB push_back
    #define amax(x, y) x = max(x, y)
    #define amin(x, y) x = min(x, y)
    #define vec vector
    /** IO **/
        template<class T> inline istream& operator>>(istream& s, vec<T>& v) { for(auto&& p : v) s >> p; return s; }
        #ifdef DEBUG
            template<class T, class S> inline ostream& operator<<(ostream&, const pair<T, S>&);
            template<class T>          inline ostream& operator<<(ostream&, const vec<T>&);
            template<class T, class S> inline ostream& operator<<(ostream&, const map<T, S>&);
            #define DEFINE_ITER_OUTPUT(s, x, sep) { int i = 0; for(const auto& x##0_elem : x) { if(i++) s << sep; s << x##0_elem; } return s; }
            template<class T, class S> inline ostream& operator<<(ostream& s, const pair<T, S>& p) { return s << "(" << p.first << "," << p.second << ")"; }
            template<class T>          inline ostream& operator<<(ostream& s, const vec<T>& v) DEFINE_ITER_OUTPUT(s, v, ' ')
            template<class T, class S> inline ostream& operator<<(ostream& s, const map<T, S>& m) DEFINE_ITER_OUTPUT(s, m, ' ')
            template<class T>          inline ostream& operator<<(ostream& s, const vec<vec<T>>& w) DEFINE_ITER_OUTPUT(s, w, '\n')
            template<class T, class S> inline ostream& operator<<(ostream& s, const vec<map<T, S>>& vm) DEFINE_ITER_OUTPUT(s, vm, '\n')
            template<class T> inline void dddf(const T& t) { cerr << t ln; }
            template<class T, class...U> inline void dddf(const T& t, const U&... u) { cerr << t << ", "; dddf(u...); }
            #define ddd(...) { cerr << #__VA_ARGS__ << " = "; dddf(__VA_ARGS__); }
        #else
            #define ddd(...) {}
        #endif
    /** container **/
        #define all(v) begin(v), end(v)
        template<class T> inline T max(const pair<T, T>& p) { return max(p.first, p.second); }
        template<class T> inline T min(const pair<T, T>& p) { return min(p.first, p.second); }
        template<class T> inline T max(const vec<T>& v) { return *max_element(all(v)); }
        template<class T> inline T min(const vec<T>& v) { return *min_element(all(v)); }
        template<class T> inline T sum(const vec<T>& v) { T s = v.empty() ? 0 : v[0]; uptil(1, v.size(), i) s += v[i]; return s; }
        template<class T> inline T sum(const vec<T>& v, int mod) { T s = v.empty() ? 0 : v[0]; uptil(1, v.size(), i) (s += v[i]) %= mod; return s; }
        template<class T, class U> inline T dig(const U& d, const T& t) { return t; }
        template<class T, class U, class...I> inline U dig(const U& d, const T& t, int i, I... j) {
            return 0 <= i && i < t.size() ? dig(d, t[i], j...) : d; }

#define INF (1LL << 60)

/************************************ main ************************************/

constexpr int Turn = 20, H = 10, W = 10;

#define Stage vec<vec<int>>

inline void putOne(Stage& s, int i, int j) {
    ++s[i][j];
    if(s[i][j] < 0) {
        s[i][j] = min(0ll, s[i][j] + 1);
    }
    s[i][j] = min(3ll, max(-3ll, s[i][j]));
}

void put(Stage& s, int i, int j, int r) {
    putOne(s, i,       j);
    putOne(s, i + r,   j + !r);
    putOne(s, i + 2*r, j + 2*!r);
}

int score(const Stage& s) {
    double sum = 0;
    int mx = INT_MIN;
    int b = 0;
    vec<int> lens;

    times(H, i) {
        // row
        double a = 0;
        int l = 0, lm = 0;
        times(W, j) {
            int k = s[i][j];
            a += (k > 0 ? 1 : -1) * pow(abs(k), 0.7);
            b += (s[i][j] > 0) - (s[i][j] < 0);
            if(s[i][j] > 0) ++l;
            else l = 0;
            amax(lm, l);
        }
        lens.push_back(lm);
        sum += a;
        amax(mx, a);
    }
    times(W, j) {
        // yoko
        double a = 0;
        int l = 0, lm = 0;
        times(H, i) {
            int k = s[i][j];
            a += (k > 0 ? 1 : -1) * pow(abs(k), 0.7);
            b += (s[i][j] > 0) - (s[i][j] < 0);
            if(s[i][j] > 0) ++l;
            else l = 0;
            amax(lm, l);
        }
        lens.push_back(lm);
        sum += a;
        amax(mx, a);
    }

    sort(all(lens));
    return (int)sum + b * 10 + mx * 10 + lens[H + W - 1] * 1000 + lens[H + W - 2] * 10;
}

void solve() {
    srand((unsigned) time(NULL));

    int T; scanf("%lld", &T);
    Stage V(H, vec<int>(W)), v0;
    times(H, i) times(W, j) scanf("%lld", &V[i][j]);

    if(T == 0) {
        cout << 5+rand()%2 sp << 5+rand()%2 sp << 0 ln;
        return;
    }
    if(T == 1) {
        cout << rand()%2*9 sp << 5+rand()%2 sp << 1 ln;
        return;
    }
    if(T == 18) {
        int x = 0;
        times(H, i) times(W, j) {
            if(V[i][j] > 0) x++;
        }
        if(x <= 3) {
            // fiord
            ;
        }
    }

    int x, y, rot, best = INT_MIN;
    times(2, r) times(H, i) times(W, j) {
        if(r == 0 && j >= W-2 || r == 1 && i >= H-2) continue;
        v0 = V;
        put(V, i, j, r);

        int sc = score(V);
        if(best < sc) {
            best = sc;
            x = j; y = i; rot = r;
        }
        V = v0;
    }

    // 中心の座標やんけ
    cout << x+1+rot sp << y+1+!rot sp << rot ln;
}

Battle History

OpponentConfigResultDate
BOT (random)Lose2018/05/20 15:15:13