Submission #3640413


Source Code Expand

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//
#define int long long
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))
//
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
//
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0};
const int dy[] = {0, -1, 1, 0, 0};
//
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int H, W;
int C[110][110];
int imos[110][110];

signed main() {
  cin >> H >> W;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      int tmp;
      cin >> tmp;
      if ((i + j) % 2 == 1) {
        tmp *= -1;
      }

      C[i][j] = tmp;
      imos[i][j] = tmp;
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      imos[i][j] += imos[i][j - 1];
    }
  }
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      imos[i][j] += imos[i - 1][j];
    }
  }

  int ans = 0;
  for (int h = 1; h <= H; h++) {
    for (int nh = 1; nh <= H; nh++) {
      for (int w = 1; w <= W; w++) {
        for (int nw = 1; nw <= W; nw++) {
          int sum = 0;
          sum += imos[nh][nw];
          sum -= imos[h - 1][nw] + imos[nh][w - 1];
          sum += imos[h - 1][w - 1];

          if (sum == 0) {
            int S = (nh - h + 1) * (nw - w + 1);
            chmax(ans, S);
          }
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task B - チョコレート
User null_null
Language C++14 (GCC 5.4.1)
Score 100
Code Size 2179 Byte
Status AC
Exec Time 180 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 5
AC × 25
Set Name Test Cases
Sample subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask0_sample-05.txt
All subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask0_sample-05.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt
Case Name Status Exec Time Memory
subtask0_sample-01.txt AC 1 ms 256 KB
subtask0_sample-02.txt AC 1 ms 256 KB
subtask0_sample-03.txt AC 1 ms 256 KB
subtask0_sample-04.txt AC 1 ms 256 KB
subtask0_sample-05.txt AC 1 ms 256 KB
subtask1_01.txt AC 1 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 1 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 1 ms 256 KB
subtask1_06.txt AC 2 ms 256 KB
subtask1_07.txt AC 1 ms 256 KB
subtask1_08.txt AC 1 ms 256 KB
subtask1_09.txt AC 175 ms 384 KB
subtask1_10.txt AC 27 ms 384 KB
subtask1_11.txt AC 141 ms 384 KB
subtask1_12.txt AC 141 ms 384 KB
subtask1_13.txt AC 141 ms 384 KB
subtask1_14.txt AC 176 ms 384 KB
subtask1_15.txt AC 180 ms 384 KB
subtask1_16.txt AC 136 ms 384 KB
subtask1_17.txt AC 140 ms 384 KB
subtask1_18.txt AC 1 ms 256 KB
subtask1_19.txt AC 1 ms 384 KB
subtask1_20.txt AC 141 ms 384 KB