CSES - Datatähti 2020 loppu - Results
Submission details
Task:Aliruudukot
Sender:Henrik Aalto
Submission time:2020-02-09 15:16:17 +0200
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED29
#2ACCEPTED34
#3ACCEPTED37
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2, 3details
#2ACCEPTED0.01 s1, 2, 3details
#3ACCEPTED0.01 s1, 2, 3details
#4ACCEPTED0.01 s1, 2, 3details
#5ACCEPTED0.01 s1, 2, 3details
#6ACCEPTED0.01 s1, 2, 3details
#7ACCEPTED0.01 s1, 2, 3details
#8ACCEPTED0.01 s1, 2, 3details
#9ACCEPTED0.01 s1, 2, 3details
#10ACCEPTED0.01 s1, 2, 3details
#11ACCEPTED0.01 s1, 2, 3details
#12ACCEPTED0.01 s1, 2, 3details
#13ACCEPTED0.01 s1, 2, 3details
#14ACCEPTED0.01 s1, 2, 3details
#15ACCEPTED0.01 s1, 2, 3details
#16ACCEPTED0.01 s1, 2, 3details
#17ACCEPTED0.01 s1, 2, 3details
#18ACCEPTED0.01 s1, 2, 3details
#19ACCEPTED0.01 s1, 2, 3details
#20ACCEPTED0.01 s1, 2, 3details
#21ACCEPTED0.01 s1, 2, 3details
#22ACCEPTED0.01 s1, 2, 3details
#23ACCEPTED0.01 s1, 2, 3details
#24ACCEPTED0.01 s1, 2, 3details
#25ACCEPTED0.01 s1, 2, 3details
#26ACCEPTED0.01 s1, 2, 3details
#27ACCEPTED0.01 s2, 3details
#28ACCEPTED0.01 s2, 3details
#29ACCEPTED0.01 s2, 3details
#30ACCEPTED0.01 s2, 3details
#31ACCEPTED0.01 s2, 3details
#32ACCEPTED0.01 s2, 3details
#33ACCEPTED0.01 s2, 3details
#34ACCEPTED0.01 s2, 3details
#35ACCEPTED0.01 s2, 3details
#36ACCEPTED0.01 s2, 3details
#37ACCEPTED0.01 s2, 3details
#38ACCEPTED0.01 s2, 3details
#39ACCEPTED0.01 s2, 3details
#40ACCEPTED0.01 s2, 3details
#41ACCEPTED0.01 s2, 3details
#42ACCEPTED0.01 s2, 3details
#43ACCEPTED0.01 s2, 3details
#44ACCEPTED0.01 s2, 3details
#45ACCEPTED0.01 s2, 3details
#46ACCEPTED0.01 s2, 3details
#47ACCEPTED0.01 s2, 3details
#48ACCEPTED0.01 s2, 3details
#49ACCEPTED0.01 s2, 3details
#50ACCEPTED0.01 s2, 3details
#51ACCEPTED0.01 s2, 3details
#52ACCEPTED0.01 s2, 3details
#53ACCEPTED0.02 s3details
#54ACCEPTED0.03 s3details
#55ACCEPTED0.11 s3details
#56ACCEPTED0.08 s3details
#57ACCEPTED0.07 s3details
#58ACCEPTED0.10 s3details
#59ACCEPTED0.16 s3details
#60ACCEPTED0.16 s3details
#61ACCEPTED0.07 s3details
#62ACCEPTED0.14 s3details
#63ACCEPTED0.14 s3details
#64ACCEPTED0.10 s3details
#65ACCEPTED0.11 s3details
#66ACCEPTED0.10 s3details
#67ACCEPTED0.13 s3details
#68ACCEPTED0.14 s3details
#69ACCEPTED0.14 s3details
#70ACCEPTED0.09 s3details
#71ACCEPTED0.12 s3details
#72ACCEPTED0.17 s3details
#73ACCEPTED0.11 s3details
#74ACCEPTED0.11 s3details
#75ACCEPTED0.13 s3details
#76ACCEPTED0.14 s3details
#77ACCEPTED0.15 s3details
#78ACCEPTED0.17 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
input/code.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", Grid[i] + 1);
   ~~~~~^~~~~~~~~~~~~~~~~~~

Code

#pragma GCC optimize "-O3"
#pragma GCC target("arch=skylake")
#include "bits/stdc++.h"
using namespace std;
int N, M;
char Grid[1111][1111];
int Res[1111][1111], Sam[1111][1111];
int main() {
	int i, j, h;
	scanf("%d%d", &N, &M);
	for (i = 1; i <= N; ++i) {
		scanf("%s", Grid[i] + 1);
	}
	for (i = 1; i <= N; ++i) {
		for (j = 1; j <= M; ++j) {
			if (Grid[i][j] == Grid[i - 1][j + 1]) Sam[i][j] = 1;
		}
	}
	for (i = 1; i <= N; ++i) {
		for (j = M; j >= 1; --j) {
			if (Sam[i][j]) Res[i][j] = Res[i][j + 1] + 1;
		}
	}
	/*
	for (i = 1; i <= N; ++i) {
		for (j = 1; j <= M; ++j) {
			printf("%d ", Res[i][j]);
		}
		puts("");
	}
	*/
	int R = max(N, M);
	for (i = 1; i <= N; ++i) {
		for (j = 1; j <= M; ++j) {
			int mi = M + 1;
			for (h = i + 1; h <= N; ++h) {
				mi = min(mi, Res[h][j] + 1);
				R = max(R, mi * (h - i + 1));
				if (mi * (N - i + 1) < R) break;
			}
		}
	}
	printf("%d\n", R);
}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCDEFGHIJ
BCDEFGHIJK
CDEFGHIJKL
DEFGHIJKLM
...

correct output
100

user output
100

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCDEFGHPJ
BCDEFGHIJK
CDEFGHIJKL
DTFGHIJKLM
...

correct output
72

user output
72

Test 3

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCDEFGHIJ
BCDEFGHIJK
CDEFGHIJKL
PEFGHJJKLM
...

correct output
40

user output
40

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCDEFGHIJ
BCDEFGHIJK
CDEFGNIJKY
DEFGHIJKLM
...

correct output
30

user output
30

Test 5

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCDEFGHIJ
BCDEFGJIJK
CDEFOHIJKL
DEFGHIJKLM
...

correct output
24

user output
24

Test 6

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
SBCDEFGHIJ
BCDEFGCIJK
CXEFGHIJKL
DEDGHIKKWM
...

correct output
20

user output
20

Test 7

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABFDEFGHIJ
BCDEFGHOJK
CDEFGNXJKL
DPFGHIJKLM
...

correct output
42

user output
42

Test 8

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABQDEFGHIA
BCDEFGHIHK
CDEFGHIJKL
DEFGHIAKGM
...

correct output
30

user output
30

Test 9

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
AYCDEFGHIJ
BCDEFGHVJK
CDEFGQIJKC
DEFGHKPKLM
...

correct output
32

user output
32

Test 10

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCREAGHQJ
NCDEFGHIJK
CDEFXHIUKL
DEFGHIJKLM
...

correct output
20

user output
20

Test 11

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCDEFGSBJ
BRDEFGHIJK
CYEFGPIPKL
DEFGHIJASM
...

correct output
16

user output
16

Test 12

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCBGFGHIJ
BCDEFOHILK
CDEFGUIJKL
DEFGHIJKLT
...

correct output
20

user output
20

Test 13

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCFEFGHIJ
BCDQFGYIJK
COEFGHIZKL
JELGHIJZLM
...

correct output
20

user output
20

Test 14

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCPNFGCIJ
ICRQFGFIJK
PDEFGHIJKL
DQFGHIJKVM
...

correct output
21

user output
21

Test 15

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
AMCJEFEIXJ
BYDEFGHIBI
CDEFGHIDKL
DEFQXQJKYM
...

correct output
15

user output
15

Test 16

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
XBCDUFGHNJ
BCDEFGHIJK
BDEFGHIJKL
DEKGHIJKLM
...

correct output
24

user output
24

Test 17

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ARCDEFMHIJ
BCDEHGSNJK
CVEFGHIJZL
DEZRHIJSDM
...

correct output
16

user output
16

Test 18

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
AGCDEOGHIJ
BADEJGHIJP
CDURGHIJKL
VELGXIJKLM
...

correct output
32

user output
32

Test 19

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCKEFGRIJ
RWBECVHGIK
COEFKHIJKL
DEVZHXBKLM
...

correct output
12

user output
12

Test 20

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABDDQFGFIJ
BXJEFKHIKK
TDSFVHILKL
HEFOHKQPLM
...

correct output
10

user output
10

Test 21

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
LBCDEFGUIJ
BCDEFGHIJK
CDZJGBIJKL
DHFGHNJXLM
...

correct output
14

user output
14

Test 22

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
BJCDEFGHIO
MLHEDOHIJH
CDEFWWIJKL
DEFNHIEKLM
...

correct output
10

user output
10

Test 23

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
ABCDEFMHIJ
WCDEFLHIJK
CDXACHIJEL
DENPVIJVAU
...

correct output
10

user output
10

Test 24

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
YBKDEFMRJF
BRDEFAHIDK
PDOFGUHJKL
NEFGHQJTHM
...

correct output
12

user output
12

Test 25

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
OBODEFGRBJ
FCDEFGHIQK
CDAFGHIJKY
DEFKHIHKLM
...

correct output
12

user output
12

Test 26

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 10
LBQDEPGHIJ
BCOEODHIJK
CHEUGQIJKL
EEHGQIJBWM
...

correct output
12

user output
12

Test 27

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
10000

user output
10000

Test 28

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
6000

user output
6000

Test 29

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
3600

user output
3600

Test 30

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
5700

user output
5700

Test 31

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
4400

user output
4400

Test 32

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCQEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
3430

user output
3430

Test 33

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
3871

user output
3871

Test 34

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
3036

user output
3036

Test 35

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
3116

user output
3116

Test 36

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
2142

user output
2142

Test 37

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMAOPQRSTUVWXYZABCD...

correct output
1920

user output
1920

Test 38

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
2205

user output
2205

Test 39

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIFKLMNOPQRSTUVWXYZABCD...

correct output
2520

user output
2520

Test 40

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
2655

user output
2655

Test 41

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
2244

user output
2244

Test 42

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEUGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1872

user output
1872

Test 43

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
2278

user output
2278

Test 44

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1500

user output
1500

Test 45

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1890

user output
1890

Test 46

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1734

user output
1734

Test 47

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
2448

user output
2448

Test 48

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHAJKLMNOPQRSTUVWXYZABCD...

correct output
1248

user output
1248

Test 49

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1953

user output
1953

Test 50

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUNWXYZABCD...

correct output
1216

user output
1216

Test 51

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1344

user output
1344

Test 52

Group: 2, 3

Verdict: ACCEPTED

input
100 100
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1422

user output
1422

Test 53

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
1000000

user output
1000000

Test 54

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
887000

user output
887000

Test 55

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
553532

user output
553532

Test 56

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
456765

user output
456765

Test 57

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
510000

user output
510000

Test 58

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
455413

user output
455413

Test 59

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
287300

user output
287300

Test 60

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
326616

user output
326616

Test 61

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
396240

user output
396240

Test 62

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
311022

user output
311022

Test 63

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
374946

user output
374946

Test 64

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
342454

user output
342454

Test 65

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
271911

user output
271911

Test 66

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
279000

user output
279000

Test 67

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
208096

user output
208096

Test 68

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
170914

user output
170914

Test 69

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
261508

user output
261508

Test 70

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
299757

user output
299757

Test 71

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
195250

user output
195250

Test 72

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
160638

user output
160638

Test 73

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
197340

user output
197340

Test 74

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
212000

user output
212000

Test 75

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
177184

user output
177184

Test 76

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
132534

user output
132534

Test 77

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
143868

user output
143868

Test 78

Group: 3

Verdict: ACCEPTED

input
1000 1000
ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...

correct output
114480

user output
114480