Submission #1593031


Source Code Expand

//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

signed main(void)
{
  const int h = 30, w = 30;
  int board[30][30] = {};
  REP(i, h) REP(j, w) cin >> board[i][j];

  int score = 0;
  while(1) {
    bool up = false;
    REP(i, h) REP(j, w) {
      if(board[i][j] > 0) {
        up = true;
        int x = j, y = i;
        board[y][x]--;
        cout << y+1 << " " << x+1 << endl;
        while(1) {
          bool update = false;
          while(IN(0, w, x+1) && board[y][x] == board[y][x+1]) {
            ++x, board[y][x]--;
            update = true;
            cout << y+1 << " " << x+1 << endl;
          }
          while(IN(0, w, x-1) && board[y][x] == board[y][x-1]) {
            --x, board[y][x]--;
            update = true;
            cout << y+1 << " " << x+1 << endl;
          }
          while(IN(0, h, y+1) && board[y][x] == board[y+1][x]) {
            ++y, board[y][x]--;
            update = true;
            cout << y+1 << " " << x+1 << endl;
          }
          while(IN(0, h, y-1) && board[y][x] == board[y-1][x]) {
            --y, board[y][x]--;
            update = true;
            cout << y+1 << " " << x+1 << endl;
          }
          if(!update) break;
        }
        score++;
      }
    }
    if(!up) break;
  }

  // cout << "score:" << 100000 - score << endl;

  return 0;
}

Submission Info

Submission Time
Task A - 高橋君の山崩しゲーム
User ferin_tech
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2134 Byte
Status WA
Exec Time 82 ms
Memory 512 KB

Judge Result

Set Name test_01 test_02 test_03 test_04 test_05 test_06 test_07 test_08 test_09 test_10
Score / Max Score 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000
Status
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
Set Name Test Cases
test_01 subtask_01_01.txt
test_02 subtask_01_02.txt
test_03 subtask_01_03.txt
test_04 subtask_01_04.txt
test_05 subtask_01_05.txt
test_06 subtask_01_06.txt
test_07 subtask_01_07.txt
test_08 subtask_01_08.txt
test_09 subtask_01_09.txt
test_10 subtask_01_10.txt
Case Name Status Exec Time Memory
subtask_01_01.txt WA 75 ms 512 KB
subtask_01_02.txt WA 78 ms 512 KB
subtask_01_03.txt WA 76 ms 512 KB
subtask_01_04.txt WA 82 ms 512 KB
subtask_01_05.txt WA 77 ms 512 KB
subtask_01_06.txt WA 79 ms 512 KB
subtask_01_07.txt WA 78 ms 512 KB
subtask_01_08.txt WA 76 ms 512 KB
subtask_01_09.txt WA 78 ms 512 KB
subtask_01_10.txt WA 79 ms 512 KB