Submission #8900531
Source Code Expand
#include <bits/stdc++.h> using namespace std; int n = 0, m = 0; char mathx[2050][2050]; bool same[2050][2050]; int up[2050][2050]; int sta[2050][2], top = 0; signed main() { scanf("%d%d", &n, &m); for(int i = 1; i <= n; i++) scanf("%s", mathx[i] + 1); for(int i = n; i >= 1; i--) for(int j = 1; j <= m; j++) { same[i][j] = (mathx[i][j] == mathx[i][j + 1]); up[i][j] = (same[i][j] != same[i + 1][j]? 1: up[i + 1][j] + 1); } int ans = max(n, m); for(int i = 1; i <= n; i++) { top = 0; for(int j = 1; j <= m; j++) { if(top > 0) { #define aol(x, a, h) (h * (x - a + 1)) int x = 1, y = top, z = 0; while(x < y) { z = x + ((y - x + 1) >> 1); if(z == 1 || aol(j, sta[z][1], sta[z][0]) >= aol(j, sta[z - 1][1], sta[z - 1][0])) x = z; else y = z - 1; } ans = max(ans, aol(j, sta[x][1], sta[x][0])); } int u = j; while(top > 0 && sta[top][0] > up[i][j]) u = sta[top][1], top--; if(!top || sta[top][0] < up[i][j]) top++, sta[top][0] = up[i][j], sta[top][1] = u; } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Flip and Rectangles |
User | Mr_Food |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1120 Byte |
Status | WA |
Exec Time | 110 ms |
Memory | 24832 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:10:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &n, &m); ^ ./Main.cpp:11:55: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for(int i = 1; i <= n; i++) scanf("%s", mathx[i] + 1); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | AC | 6 ms | 23808 KB |
10.txt | AC | 105 ms | 24832 KB |
11.txt | AC | 25 ms | 24832 KB |
12.txt | AC | 33 ms | 24832 KB |
13.txt | AC | 50 ms | 24832 KB |
14.txt | AC | 51 ms | 24832 KB |
15.txt | AC | 54 ms | 24832 KB |
16.txt | AC | 56 ms | 24832 KB |
17.txt | AC | 56 ms | 24832 KB |
18.txt | AC | 110 ms | 24832 KB |
19.txt | AC | 100 ms | 24832 KB |
2.txt | AC | 2 ms | 4352 KB |
20.txt | AC | 105 ms | 24832 KB |
21.txt | AC | 105 ms | 24832 KB |
22.txt | AC | 106 ms | 24832 KB |
23.txt | AC | 106 ms | 24832 KB |
24.txt | AC | 33 ms | 24832 KB |
25.txt | AC | 33 ms | 24832 KB |
26.txt | AC | 92 ms | 24832 KB |
27.txt | AC | 79 ms | 24832 KB |
28.txt | AC | 68 ms | 24832 KB |
29.txt | AC | 37 ms | 24832 KB |
3.txt | AC | 78 ms | 24832 KB |
30.txt | AC | 52 ms | 24832 KB |
31.txt | AC | 51 ms | 24832 KB |
32.txt | AC | 56 ms | 24832 KB |
33.txt | AC | 85 ms | 24832 KB |
34.txt | AC | 62 ms | 24832 KB |
4.txt | AC | 78 ms | 24832 KB |
5.txt | AC | 6 ms | 23808 KB |
6.txt | AC | 2 ms | 4352 KB |
7.txt | WA | 100 ms | 24832 KB |
8.txt | AC | 100 ms | 24832 KB |
9.txt | AC | 105 ms | 24832 KB |
sample1.txt | AC | 2 ms | 4352 KB |
sample2.txt | AC | 2 ms | 4352 KB |
sample3.txt | AC | 2 ms | 4352 KB |