Submission #1990229
Source Code Expand
#include"bits/stdc++.h" using namespace std; int main() { int H, W; cin >> H >> W; vector<vector<int>> C(H, vector<int>(W)); vector<vector<int>> sum(H + 1, vector<int>(W + 1, 0)); for (int h = 1; h < H; h++) { for (int w = 1; w < W; w++) { cin >> sum[h][w]; if ((h + w) % 2 == 1) { sum[h][w] *= -1; } } } vector<vector<int>> sum(H + 1, vector<int>(W + 1, 0)); for (int h = 1; h <= H; h++) { for (int w = 1; w <= W; w++) { sum[h][w] += sum[h - 1][w] + sum[h][w - 1] - sum[h - 1][w - 1]; } } int ans = 0; for (int left = 0; left < W; left++) { for (int right = left + 1; right <= W; right++) { for (int up = 0; up < H; up++) { for (int down = up + 1; down <= H; down++) { if (sum[down][right] - sum[up][right] - sum[down][left] + sum[up][left] == 0) { ans = max(ans, (down - up) * (right - left)); } } } } } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - チョコレート |
User | tokumini |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1156 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:19:29: error: redeclaration of ‘std::vector<std::vector<int> > sum’ vector<vector<int>> sum(H + 1, vector<int>(W + 1, 0)); ^ ./Main.cpp:8:25: note: ‘std::vector<std::vector<int> > sum’ previously declared here vector<vector<int>> sum(H + 1, vector<int>(W + 1, 0)); ^