結果

問題 No.5002 stick xor
ユーザー deletend_deletend_
提出日時 2018-05-26 03:46:25
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 2,076 bytes
コンパイル時間 2,796 ms
実行使用メモリ 1,548 KB
スコア 0
最終ジャッジ日時 2018-05-26 03:46:30
ジャッジサーバーID
(参考情報)
judge10 /
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 WA -
testcase_03 RE -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int n, k, l[500], ans[500][4];
bool a[60][60];

void initialization() {
  rep(ii, 0, k) {
    int mr = 0, r = 0;
    int hi[4];
    rep(i, 0, n) {
      rep(j, 0, n) {
        if(a[i][j]) r++;
        else {
          if(mr < r) {
            mr = r;
            hi[0] = i, hi[1] = j - r - 1;
            hi[2] = i, hi[3] = j - 1;
          }
          r = 0;
        }
        if(r == l[ii]) {
          mr = r;
          hi[0] = i, hi[1] = j - r - 1;
          hi[2] = i, hi[3] = j - 1;
        }
      }
    }
    if(mr < r) {
      mr = r;
      hi[0] = n - 1, hi[1] = n - 1 - r - 1;
      hi[2] = n - 1, hi[3] = n - 1 - 1;
    }
    r = 0;
    rep(i, 0, n) {
      rep(j, 0, n) {
        if(a[j][i]) r++;
        else {
          if(mr < r) {
            mr = r;
            hi[0] = i - r - 1, hi[1] = j;
            hi[2] = i - 1, hi[3] = j;
          }
          r = 0;
        }
      }
    }
    if(mr < r) {
      hi[0] = n - 1, hi[1] = n - 1 - r - 1;
      hi[2] = n - 1, hi[3] = n - 1 - 1;
    }
    rep(i, hi[0], hi[2] + 1) rep(j, hi[1], hi[3] + 1) a[i][j] = !a[i][j];
    rep(i, 0, 4) ans[k][i] = hi[i];
  }
}

int totalScore() {
  int score = 0;
  rep(i, 0, n) rep(j, 0, n) if(!a[i][j]) score++;
  return score;
}

int YXShiftScore(int x1, int x2, int i) {

}

int XYShiftScore(int y1, int y2, int i) {

}

int XXShiftScore(int x1, int x2, int i) {

}

int YYShiftScore(int y1, int y2, int i) {

}

signed main() {
  cin >> n >> k;
  rep(i, 0, k) cin >> l[i];
  rep(i, 0, n) {
    string s;
    cin >> s;
    rep(j, 0, n) a[i][j] = s[i] == '0' ? 0 : 1;
  }
  initialization();
  rep(i, 0, k) {
    rep(j, 0, 4) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
}
0