CSES - Datatähti 2020 loppu - Results
Submission details
Task:Aliruudukot
Sender:Aaron Äärelä
Submission time:2020-02-09 16:23:43 +0200
Language:C++11
Status:COMPILE ERROR

Compiler report

input/code.cpp:3:1: error: expected ';' before 'int'
 int h, w;
 ^~~

Code

#include <bits/stdc++.h>
using namespace std
int h, w;
int ht, wt;
char t[1000][1000];
int fs = 0;
char f[10000];
int tt(int x, int y, int k){
	if(fs && t[y][x] != f[k]) return 0;
	if(!fs) f[k] = t[y][x];
	if(x == wt && y == ht) fs = 1;
	if(x != wt) if(!tt(x + 1, y, k + 1)) return 0;
	if(y != ht) if(!tt(x, y + 1, k + 1)) return 0;
	return 1;
}
int main(){
	cin >> h >> w;
	for(int i = 0; i < h; i++){
	for(int j = 0; j < w; j++){
		cin >> t[i][j];	
	}
	}
	int ms = 0;
	for(int y1 = 0; y1 < h; y1++){
	for(int x1 = 0; x1 < w; x1++){
		for(int y2 = y1; y2 < h; y2++){
		for(int x2 = x1; x2 < w; x2++){
			int s = (x2 - x1 + 1) * (y2 - y1 + 1);
			if(s <= ms) continue;
			fs = 0;
			if(tt(x1, y1, 0)) ms = s;
		}
		}
	}
	}
	cout << ms << '\n';
	return 0;
}