CSES - Datatähti 2020 loppu - Results
Submission details
Task:Alueet
Sender:Henrik Aalto
Submission time:2020-02-09 15:38:43 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 3details
#20.01 s1, 3details
#30.01 s1, 3details
#40.01 s1, 3details
#50.01 s1, 3details
#60.01 s1, 3details
#70.01 s1, 3details
#80.01 s1, 3details
#90.01 s1, 3details
#100.01 s1, 3details
#110.01 s1, 3details
#120.01 s1, 3details
#130.01 s1, 3details
#140.01 s1, 3details
#150.01 s1, 3details
#160.01 s1, 3details
#170.01 s1, 3details
#180.01 s1, 3details
#190.01 s1, 3details
#200.01 s1, 3details
#210.01 s1, 3details
#220.01 s1, 3details
#230.01 s1, 3details
#240.01 s1, 3details
#250.01 s1, 3details
#26ACCEPTED0.01 s1, 2, 3details
#270.01 s1, 3details
#280.01 s1, 3details
#290.01 s1, 3details
#300.01 s1, 3details
#310.01 s1, 3details
#320.01 s1, 3details
#330.01 s1, 3details
#340.01 s1, 3details
#350.01 s1, 3details
#360.01 s1, 3details
#370.01 s2, 3details
#380.01 s2, 3details
#39ACCEPTED0.01 s2, 3details
#400.01 s2, 3details
#410.01 s2, 3details
#420.01 s2, 3details
#430.01 s2, 3details
#440.01 s2, 3details
#450.01 s2, 3details
#46ACCEPTED0.01 s2, 3details
#470.01 s2, 3details
#480.01 s2, 3details
#490.01 s2, 3details
#500.01 s2, 3details
#510.01 s2, 3details
#520.01 s2, 3details
#530.01 s2, 3details
#540.01 s2, 3details
#550.01 s2, 3details
#560.01 s2, 3details
#570.01 s2, 3details
#580.01 s2, 3details
#590.01 s2, 3details
#600.01 s2, 3details
#610.01 s2, 3details
#620.01 s3details
#630.01 s3details
#640.01 s3details
#650.01 s3details
#660.01 s3details
#670.01 s3details
#680.01 s3details
#690.01 s3details
#700.01 s3details
#710.01 s3details
#720.01 s3details
#730.01 s3details
#740.01 s3details
#750.01 s3details
#760.01 s3details
#770.01 s3details
#780.01 s3details
#790.01 s3details
#800.01 s3details
#810.01 s3details
#820.01 s3details
#830.01 s3details
#840.01 s3details
#850.01 s3details
#860.01 s3details
#870.01 s3details
#880.01 s3details
#890.01 s3details
#900.01 s3details
#910.01 s3details
#920.01 s3details
#930.01 s3details
#940.01 s3details
#950.01 s3details
#960.01 s3details

Compiler report

input/code.cpp: In function 'int Lit(int, int, int, int)':
input/code.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
input/code.cpp: In function 'int main()':
input/code.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d", &N, &M, &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp:37:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", Grid[i] + 1);
   ~~~~~^~~~~~~~~~~~~~~~~~~

Code

#include "bits/stdc++.h"
using namespace std;
map<pair<int, int>, vector<pair<int, int>>> Gr;
int Li[2222 * 2222];
int Fi(int x) {
	return x == Li[x] ? x : (Li[x] = Fi(Li[x]));
}
int N, M, a, b, sz;
int Lit(int ax, int bx, int ay, int by) {
	int X = (bx - 1) * N * a + ax;
	int Y = (by - 1) * N * a + ay;
	X = Fi(X);
	Y = Fi(Y);
	if (X != Y) sz++;
	Li[Fi(X)] = Fi(Y);
}
char Grid[2222][2222];
map<pair<int, int>, int> Vis;
vector<pair<int, int>> GetAll(pair<int, int> Pos) {
	vector<pair<int, int>> Ret;
	if (Vis[Pos]) return Ret;
	Vis[Pos] = 1;
	if (Gr[Pos].size()) {
		for (auto &u : Gr[Pos]) {
			auto K = GetAll(u);
			if (!K.size()) continue;
			for (auto &z : K) Ret.push_back(z);
		}
	}
	Ret.push_back(Pos);
	return Ret;
}
int main() {
	int i, j;
	scanf("%d%d%d%d", &N, &M, &a, &b);
	for (i = 1; i <= N; ++i) {
		scanf("%s", Grid[i] + 1);
	}
	if (a <= 2 && b != 1) {
		for (i = 1; i <= N * a; ++i) {
			for (j = 1; j <= M * b; ++j) {
				if (i <= N && j <= M) continue;
				Grid[i][j] = Grid[(i-1)%N+1][(j-1)%M+1];
			}
		}
		for (i = 0; i <= N * M * a * b; ++i) Li[i] = i;
		for (i = 1; i <= N * a; ++i) {
			for (j = 1; j <= M * b; ++j) {
				if (Grid[i][j] == Grid[i + 1][j]) Lit(i, j, i + 1, j);
				if (Grid[i][j] == Grid[i][j + 1]) Lit(i, j, i, j + 1);
			}
		}
		printf("%d\n", N * a * b * M - sz);
	} else {
		for (i = 1; i <= N * 3; ++i) {
			for (j = 1; j <= M; ++j) {
				if (i <= N && j <= M) continue;
				Grid[i][j] = Grid[(i-1)%N+1][(j-1)%M+1];
			}
		}
		for (i = 1; i < N * 3; ++i) {
			for (j = 1; j <= M; ++j) {
				if (Grid[i][j] == Grid[i + 1][j]) Gr[{i, j}].emplace_back(i + 1, j);
				if (Grid[i][j] == Grid[i + 1][j]) Gr[{i + 1, j}].emplace_back(i, j);
				if (Grid[i][j] == Grid[i][j + 1]) Gr[{i, j}].emplace_back(i, j + 1);
				if (Grid[i][j] == Grid[i][j + 1]) Gr[{i, j + 1}].emplace_back(i, j);
			}
		}
		long long Amt = 0;
		for (i = N + 1; i <= N * 2; ++i) {
			for (j = 1; j <= M; ++j) {
				if (!Vis[{i, j}]) {
					auto U = GetAll({i, j});
					int mi = (*min_element(U.begin(), U.end())).first;
					int ma = (*max_element(U.begin(), U.end())).first;
					if (N + 1 <= mi && ma <= N * 2) {
						// printf("Amt += a (%d, %d)\n", i, j);
						Amt += a;
						continue;
					}
					if (ma > N * 2) {
						// printf("Amt += a + 1 (%d, %d)\n", i, j);
						Amt += a + 1;
						continue;
					}
					if (mi < N + 1) continue;
					// printf("Amt += 1 (%d, %d)\n", i, j);
					Amt++;
				}
			}
		}
		printf("%lld\n", Amt);
	}
}

Test details

Test 1

Group: 1, 3

Verdict:

input
3 2 4 5
AB
BA
AA

correct output
49

user output
13

Test 2

Group: 1, 3

Verdict:

input
3 3 96 18
ABB
BAB
BBA

correct output
5298

user output
385

Test 3

Group: 1, 3

Verdict:

input
5 5 74 39
BABAA
BAAAB
BAABB
BBAAA
...

correct output
5887

user output
298

Test 4

Group: 1, 3

Verdict:

input
6 12 37 96
BABABBBBBBBB
BBABBBBBABBB
BBBAABAABBAB
BABBAAAABABB
...

correct output
32162

user output
371

Test 5

Group: 1, 3

Verdict:

input
9 7 93 94
BABBAAB
AABBBAB
AAAABBB
ABAABAB
...

correct output
61567

user output
931

Test 6

Group: 1, 3

Verdict:

input
5 5 50 57
AAAAA
AAAAB
AABBA
AABBA
...

correct output
8609

user output
201

Test 7

Group: 1, 3

Verdict:

input
5 10 92 59
AABABBAAAA
AABAABABAA
AAABBABBBB
BBAAAAABBB
...

correct output
22191

user output
648

Test 8

Group: 1, 3

Verdict:

input
17 4 5 37
ABBA
ABBA
AABB
AABA
...

correct output
1317

user output
61

Test 9

Group: 1, 3

Verdict:

input
9 14 53 31
BBBBAAABBABABA
AAAABAAABABBAB
AABBBBBAAAABAA
BBBAABABABABAB
...

correct output
29879

user output
1222

Test 10

Group: 1, 3

Verdict:

input
14 4 11 46
BAAA
BBAB
BABB
BBBB
...

correct output
2105

user output
89

Test 11

Group: 1, 3

Verdict:

input
15 12 49 41
ABBBAAAAAAAA
AAABBBAABAAB
BAABABBABBAB
AAAAAABBBAAB
...

correct output
42565

user output
1324

Test 12

Group: 1, 3

Verdict:

input
13 5 36 80
AABBB
AAAAA
ABAAA
BBBBA
...

correct output
11638

user output
218

Test 13

Group: 1, 3

Verdict:

input
14 19 96 13
BBBAABBBBBBBBABABAB
BBABBAAAABBBBBBBABA
ABAAABBBABBBABBBBBA
AAAABBABAAABBBAAABA
...

correct output
37889

user output
3268

Test 14

Group: 1, 3

Verdict:

input
6 17 74 78
AABAABBBABBAABABB
AABBABABBBBBAAAAB
BBABBBABABBBBBBAB
ABBABABBABBABBBAA
...

correct output
92814

user output
1409

Test 15

Group: 1, 3

Verdict:

input
10 8 76 100
ABAABABB
BABAABBB
AABABBBB
BAABBBBA
...

correct output
76704

user output
1143

Test 16

Group: 1, 3

Verdict:

input
20 20 100 100
AABABABBAABABABBBAAA
AAAABBBBAAABBAAAABAB
BAAAABAAAAABABABBAAB
BABAABABABAABBBAABAA
...

correct output
431101

user output
5105

Test 17

Group: 1, 3

Verdict:

input
20 20 100 100
AAAAAABAABABAAABBABB
AABAABABBAAAAABABAAA
BBBAAAABBABBAABAAAAB
BAABAAABAABBAABBBBAA
...

correct output
421004

user output
4704

Test 18

Group: 1, 3

Verdict:

input
20 20 100 100
BBAAABABBBBAAABBBAAA
BBABBAABBBBABAAAABBA
BAAABBAAABAAAAABAAAA
AABBABAABBBBBABBBBAB
...

correct output
431100

user output
4804

Test 19

Group: 1, 3

Verdict:

input
20 20 100 100
BAABBBBBAABBBABBAAAB
BAAAAAABBABBABBABAAA
AAAAABABAABABBABAAAB
AAAAABAABBBBBABBABBB
...

correct output
531102

user output
5805

Test 20

Group: 1, 3

Verdict:

input
20 20 100 100
AABAABBBBABAAAABABBA
AAABAABBAABBABAAABBB
AABAAABBBABAAAAAAABB
AABBBBAAAABABBAAAAAA
...

correct output
421001

user output
4804

Test 21

Group: 1, 3

Verdict:

input
20 20 100 100
AABBAAABAABBBBBAABBB
ABBAABAAABAABBABBBBA
BBAAAABBAAAAAAABBBBA
ABBBAAABBBBBBBBBAAAB
...

correct output
421302

user output
5106

Test 22

Group: 1, 3

Verdict:

input
20 20 100 100
ABBABABAABAAAAABAABB
ABBAAABBABBBAABBBBBA
BAABBAAABABBABBAABBB
ABABBABAAABBBBABBBBB
...

correct output
501500

user output
5904

Test 23

Group: 1, 3

Verdict:

input
3 6 46 16
AABABB
ABAAAA
AABAAB

correct output
2257

user output
234

Test 24

Group: 1, 3

Verdict:

input
13 6 34 11
BBAABB
ABAAAA
AAABAB
ABAAAA
...

correct output
3626

user output
545

Test 25

Group: 1, 3

Verdict:

input
9 9 80 2
ABAAABBAB
ABAABBABB
BABBBAAAB
AABBAABBB
...

correct output
2010

user output
1124

Test 26

Group: 1, 2, 3

Verdict: ACCEPTED

input
4 1 4 1
P
G
N
M

correct output
16

user output
16

Test 27

Group: 1, 3

Verdict:

input
14 6 38 40
XXBVMN
ABAXHQ
CSMGQM
OPQHVF
...

correct output
120158

user output
3041

Test 28

Group: 1, 3

Verdict:

input
20 18 99 100
AAAAABBAAAABBBBABB
BBABAABBBAABBABBAB
BAABAAAAAAABBABABB
ABABABAABAABABABBA
...

correct output
476491

user output
5646

Test 29

Group: 1, 3

Verdict:

input
18 18 98 100
ABABBBBBABBABABABB
BABABAAABBBBBBAABA
BBABAABABBAAABBBBA
AABBBABAABAAAABAAA
...

correct output
520588

user output
5785

Test 30

Group: 1, 3

Verdict:

input
20 18 98 99
QLVVDEECSBKBAAGNMR
NBHNTIHGEAAAKBLATP
TAPQIIQSECNOHRQFOL
NUQOFTGANCLKGPQAUL
...

correct output
3114342

user output
31458

Test 31

Group: 1, 3

Verdict:

input
19 20 100 99
FADFAHACEIEGGHBJCEHC
ADAFFEBFEFDBBJBHICCF
JGDBIJFGEJDCIJBJCBCI
DEIDCEDBDECHBEGHAIGC
...

correct output
3039795

user output
30705

Test 32

Group: 1, 3

Verdict:

input
20 20 100 100
AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAA
...

correct output
1

user output
101

Test 33

Group: 1, 3

Verdict:

input
20 20 100 100
ABABABABABABABABABAB
BABABABABABABABABABA
ABABABABABABABABABAB
BABABABABABABABABABA
...

correct output
4000000

user output
40000

Test 34

Group: 1, 3

Verdict:

input
20 20 100 100
BAAAAAAAAAAAAAAAAAAA
BABBBBBBBBBBBBBBBBBB
AABAAAAAAAAAAAAAAAAA
BBBABBBBBBBBBBBBBBBB
...

correct output
2000

user output
1802

Test 35

Group: 1, 3

Verdict:

input
20 20 100 100
AABBAABBAABBAABBAABB
ABBAABBAABBAABBAABBA
BBAABBAABBAABBAABBAA
BAABBAABBAABBAABBAAB
...

correct output
2000

user output
1010

Test 36

Group: 1, 3

Verdict:

input
20 20 100 100
AABBAABBAABBAABBAABB
BAABBAABBAABBAABBAAB
BBAABBAABBAABBAABBAA
ABBAABBAABBAABBAABBA
...

correct output
2000

user output
1010

Test 37

Group: 2, 3

Verdict:

input
20 20 999999998 1
BBABABABABABABABABAB
AAABABABABABABABABAB
ABBBABABABABABABABAB
ABAAABABABABABABABAB
...

correct output
0

user output
17999999982

Test 38

Group: 2, 3

Verdict:

input
20 20 675864715 1
AABBAABBAABBAABBAABB
BAABBAABBAABBAABBAAB
BBAABBAABBAABBAABBAA
ABBAABBAABBAABBAABBA
...

correct output
758647118

user output
6758647160

Test 39

Group: 2, 3

Verdict: ACCEPTED

input
20 20 93295188 1
AABBAABBAABBAABBAABB
ABBAABBAABBAABBAABBA
BBAABBAABBAABBAABBAA
BAABBAABBAABBAABBAAB
...

correct output
932951890

user output
932951890

Test 40

Group: 2, 3

Verdict:

input
20 20 859593956 1
BAAAAAAAAAAAAAAAAAAA
BABBBBBBBBBBBBBBBBBB
AABAAAAAAAAAAAAAAAAA
BBBABBBBBBBBBBBBBBBB
...

correct output
472691105

user output
15472691210

Test 41

Group: 2, 3

Verdict:

input
9 19 451807869 1
BBAABBBBABBABABAAAA
ABBBBBAAABABBBABBBB
BBBBABABBABABBAABBB
BBAAABABBABABBBABBA
...

correct output
295196654

user output
11295196728

Test 42

Group: 2, 3

Verdict:

input
18 5 215145109 1
BABBB
AAABA
ABBBB
ABAAB
...

correct output
442321725

user output
3442321746

Test 43

Group: 2, 3

Verdict:

input
18 20 73784726 1
DEEAEEBCDEABEEAACAEC
DACECBDCDABACBDDCDDD
CEAACDCABDAEBDDDAADB
BBDECECCBEABBCAEDACE
...

correct output
716146536

user output
15716146641

Test 44

Group: 2, 3

Verdict:

input
8 7 859156029 1
QNQHFJR
CRELECQ
RBMHCSL
LTKPFRR
...

correct output
253581266

user output
47253581595

Test 45

Group: 2, 3

Verdict:

input
10 9 405141701 1
BBBBAABAA
ABBBABAAB
AABBABBBB
BBABBABAB
...

correct output
77125475

user output
6077125517

Test 46

Group: 2, 3

Verdict: ACCEPTED

input
18 2 31774979 1
BB
BB
BB
AB
...

correct output
349524770

user output
349524770

Test 47

Group: 2, 3

Verdict:

input
8 8 562418738 1
QNIOBEEN
GPAGHOMG
EMEHMQHM
EPIPJPJQ
...

correct output
808192912

user output
29808193115

Test 48

Group: 2, 3

Verdict:

input
13 12 800612914 1
IRTAUAOQZMYD
FKPNIVFEOBCL
IAXGXZAHNJUJ
DJUKIKCULNQN
...

correct output
288258811

user output
115288259616

Test 49

Group: 2, 3

Verdict:

input
18 8 628714184 1
PEONHLBB
TBBGKLVM
DFYIABLL
RMOVFLVT
...

correct output
505128429

user output
85505129024

Test 50

Group: 2, 3

Verdict:

input
17 5 779080796 1
BBBBB
BAABA
ABAAA
BABAB
...

correct output
581615816

user output
15581615921

Test 51

Group: 2, 3

Verdict:

input
20 20 811848168 1
BABAABBBBBABAABBAABB
ABAAAABBAABABABBBABB
BBAABAAABBAABAAAABBB
AABABAABBABABABAABAB
...

correct output
710889751

user output
48710890086

Test 52

Group: 2, 3

Verdict:

input
20 20 106342603 1
BBAABABBBABBABABBBAB
BAAAAAABAAAABBBAABAB
BBBABBABAABBBABBBAAA
BBABBBBBBABBABAABAAB
...

correct output
742500534

user output
5742500569

Test 53

Group: 2, 3

Verdict:

input
20 20 996646059 1
BAABABAABAABABBBBAAA
AABABBBABABABBAABBBA
ABBAABAAABAAAAAABAAB
BAABBAAABBBBABAAABBA
...

correct output
778639448

user output
65778639900

Test 54

Group: 2, 3

Verdict:

input
20 20 516122916 1
AABAAAABBABBABAAABBA
BABBBAAAABBAABABBABA
BABAABAABABAAABBABAA
BABAAABBAABBABABABAA
...

correct output
419006017

user output
29419006218

Test 55

Group: 2, 3

Verdict:

input
20 20 164639647 1
BAABBABAABBBABBBBAAA
ABAAABAAAAABBABABBAA
AAABBAABAABBBABBABBA
ABABAAABABABBAABBBAB
...

correct output
890540889

user output
8890540943

Test 56

Group: 2, 3

Verdict:

input
20 20 534414813 1
AAAABBABAAABBABBBABA
AABBBAABAAABABABAABA
BAABBBABABBBBAAABBBB
BAABABBABBABAABABABA
...

correct output
255155281

user output
27255155467

Test 57

Group: 2, 3

Verdict:

input
20 20 706352424 1
AABBAABBABBABAAAAAAB
BABAABAABAAABBBAABAB
ABABBBBBABBBBAAABAAA
ABAABABBABABABAABBBB
...

correct output
206554828

user output
45206555141

Test 58

Group: 2, 3

Verdict:

input
20 20 649579476 1
ABABBBBABAABBBBBBABB
BBAABBAABBAAAABBBABB
BAABBBBBAABBBAABABBB
ABABBBAABBABABBAAABB
...

correct output
376450413

user output
36376450663

Test 59

Group: 2, 3

Verdict:

input
20 20 298308182 1
BABAABABABAAAABAABBB
ABAABABBABAAAAABBBBA
BBABAABBABBBABBAAAAB
BBAABABABBAAABBBAABB
...

correct output
196798982

user output
18196799107

Test 60

Group: 2, 3

Verdict:

input
20 20 9635356 1
ABABAAAAABABAAABBAAA
BBBAAABABBABBBBBBABB
ABAABBBABABBAABBABBB
BAABAAAAABABBBABBBAA
...

correct output
722651706

user output
722651705

Test 61

Group: 2, 3

Verdict:

input
20 20 103559165 1
BBBAABAABAABBBBAABBA
BAAAAAABAAABBBBAAABB
AABBABBBBBABABAABBBA
BABBABAABAAABABBBBBA
...

correct output
142366580

user output
4142366605

Test 62

Group: 3

Verdict:

input
3 3 456113515 704946263
AAA
ABB
ABA

correct output
652295842

user output
912227031

Test 63

Group: 3

Verdict:

input
8 14 743818701 51499980
ABBAABAABBAABB
ABBBBAAAAAABAB
BBAAABAAABBBAB
AAABBBBABBAABB
...

correct output
476592507

user output
9669643116

Test 64

Group: 3

Verdict:

input
8 10 867907943 88246137
BBBBABABBB
BABBAABBAB
BABABBAAAB
ABBABBBABB
...

correct output
391556003

user output
9546987375

Test 65

Group: 3

Verdict:

input
7 20 69289514 23926639
AAABABAAAABAABBBBBAB
BBABBBAAAAABAABABBBB
ABABABAAABAAABBBBBBB
ABABABBABABAABBABABA
...

correct output
854669536

user output
1732237853

Test 66

Group: 3

Verdict:

input
8 15 840301511 481634116
BBBBBBAAABBAAAB
BAAAABABAABBBAB
BBBAABBBBBAAAAA
AAABBABABBAABAA
...

correct output
875048540

user output
11764221156

Test 67

Group: 3

Verdict:

input
12 6 912393308 803560188
AAAAAB
AAAAAA
BBABAB
BBAABB
...

correct output
474035030

user output
8211539774

Test 68

Group: 3

Verdict:

input
6 8 214918899 468968518
BBBBAAAA
BBBBBBAA
BBBABABA
AAABAABA
...

correct output
863729741

user output
1074594497

Test 69

Group: 3

Verdict:

input
6 9 59122463 29755657
AAAAABBBB
AAABAABBB
AAAAAAAAA
BBBBBAAAA
...

correct output
212637108

user output
236489854

Test 70

Group: 3

Verdict:

input
10 6 692470036 720894753
BBABAB
BBAABB
AABBBB
ABBBAA
...

correct output
406709536

user output
7617170398

Test 71

Group: 3

Verdict:

input
12 14 925313877 700313174
BBABAAABBABBBB
ABABAABBBAABBA
AAABAABBBBABBA
BAABAABABBAABB
...

correct output
160362600

user output
14805022035

Test 72

Group: 3

Verdict:

input
9 8 308222888 171334586
ABAAABAA
BBBAABBA
BAABBABA
BBABABBB
...

correct output
162292142

user output
4315120436

Test 73

Group: 3

Verdict:

input
20 19 859012119 1103593
BBABBBABAAABBBAAABA
BAAAAABBABBABABAABA
BAAABBABAABBBAABBAB
BBAABAAAAABBABBABBB
...

correct output
27244656

user output
43809618076

Test 74

Group: 3

Verdict:

input
19 20 867639889 24371744
ABBABABAABBABBBABABB
AABAAABBABAAABBABAAB
AABBABAAABBBAABAABAB
BBBBAAAABABAAAABABAB
...

correct output
433164344

user output
41646714677

Test 75

Group: 3

Verdict:

input
20 20 461026240 854167036
BBBBAAABBABAABBAAAAB
BABABABABABAABAAAAAB
BBBABABBAABAABABAABA
AAAAABBABAAABAAAAABB
...

correct output
976798562

user output
28583626883

Test 76

Group: 3

Verdict:

input
18 18 416365726 135576991
AABAABBABBABAABABA
ABABBABAABAABBBBAA
AABBBBBAAABAAAAAAA
BAAAAAABAABAABABBB
...

correct output
884411688

user output
19569189126

Test 77

Group: 3

Verdict:

input
19 18 911475114 981811455
AAAAAAAABABBAAAAAA
ABBBAABABBABBBBAAA
BBBABABBABAABAAABA
ABBABAAABBABBBBAAB
...

correct output
528861784

user output
51042606387

Test 78

Group: 3

Verdict:

input
18 20 596983265 456868203
BBBAAABBAABBBBBBAAAB
ABAABAABAABABBABABAA
ABAAAABBABABBBBBABAB
ABABAABBBAAAAAAAAAAB
...

correct output
179830991

user output
25670280399

Test 79

Group: 3

Verdict:

input
20 20 1000000000 1000000000
AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAA
...

correct output
1

user output
1000000001

Test 80

Group: 3

Verdict:

input
20 20 1000000000 1000000000
ABABABABABABABABABAB
BABABABABABABABABABA
ABABABABABABABABABAB
BABABABABABABABABABA
...

correct output
19600

user output
400000000000

Test 81

Group: 3

Verdict:

input
20 20 534426511 510399332
AABBAABBAABBAABBAABB
BAABBAABBAABBAABBAAB
BBAABBAABBAABBAABBAA
ABBAABBAABBAABBAABBA
...

correct output
448258360

user output
5344265120

Test 82

Group: 3

Verdict:

input
20 20 968602846 454327448
AABBAABBAABBAABBAABB
ABBAABBAABBAABBAABBA
BBAABBAABBAABBAABBAA
BAABBAABBAABBAABBAAB
...

correct output
229302842

user output
9686028470

Test 83

Group: 3

Verdict:

input
20 20 215745358 122512772
BAAAAAAAAAAAAAAAAAAA
BABBBBBBBBBBBBBBBBBB
AABAAAAAAAAAAAAAAAAA
BBBABBBBBBBBBBBBBBBB
...

correct output
128441960

user output
3883416446

Test 84

Group: 3

Verdict:

input
20 20 515577344 419057317
BBABABABABABABABABAB
AAABABABABABABABABAB
ABBBABABABABABABABAB
ABAAABABABABABABABAB
...

correct output
574186338

user output
9280392210

Test 85

Group: 3

Verdict:

input
19 18 277074155 769837940
BAABBABBBBABBBABBB
ABABAAABABAAAABBAB
BBBAAABABBABBAAAAB
BBABABBBAABBABAABA
...

correct output
424550984

user output
13576633601

Test 86

Group: 3

Verdict:

input
19 19 14349140 136555934
ABFIAMIHJGAAMLLJDCE
GADMEFFDIMMFCDHGIBF
BECHCFABLGAKCABCKHE
GMKMEJIBGBEEMKELGJK
...

correct output
480469347

user output
4390836841

Test 87

Group: 3

Verdict:

input
20 19 252480072 384139973
AAABAABBBAABAAABABA
ABABBAAABABABAABBBA
AAAABBBABBBBBAABABB
ABBABBABBBAABABAABA
...

correct output
323992721

user output
15148804328

Test 88

Group: 3

Verdict:

input
18 20 808966956 194764004
FHBGCAFEFFFJJCDCIHEE
GJDJGFJAIECHBBDJAIDD
EHCHCEFACAJJJIGGBEBB
EHFDHJDADHJGICGCCCFG
...

correct output
521981688

user output
224892813770

Test 89

Group: 3

Verdict:

input
19 19 792491941 694330393
BAABBBABBAABBBBBBAA
BABBAABAAAAABAAABBB
AAAAAAAAABABBBABBBB
BABBAABBAABBBBAAAAA
...

correct output
627592320

user output
44379548700

Test 90

Group: 3

Verdict:

input
20 19 769561679 618893586
AABABBBBBBBABAABBBA
BBAAAABAAAAAAABAABB
ABBABBABAAABBBAAAAB
BBBBBAABAAABBBAAAAA
...

correct output
851646723

user output
35399837242

Test 91

Group: 3

Verdict:

input
18 19 308379941 589515629
ACBBBKKHGIIGHCHKFJB
GBHDBDJGIAGHHFFADKJ
FHAHJJEDEJKEKADKBKL
GIFBADLECHAAELKGJLK
...

correct output
890991727

user output
85112863717

Test 92

Group: 3

Verdict:

input
18 19 553801487 825546077
ABAAABABABAABABBAAA
BAAAAABAAAAAABBBABA
ABABABABABBAAABBBBA
AABBABBBBAABBABBABA
...

correct output
590655675

user output
28243875842

Test 93

Group: 3

Verdict:

input
18 18 982153622 311043226
MCMPHGAOGEACNIPFNK
JHDADENHPJBDINLLII
CAKHPFDJOOFBJJMKIC
OJMJMHHCDAJHLGOAMB
...

correct output
259160804

user output
281878089515

Test 94

Group: 3

Verdict:

input
20 19 770738892 286201314
BBBABBABABAAABAABAB
AAABAABBBBAAABABBAA
ABABABAABBAABBAABBA
BBBBABAABAABABBBBBA
...

correct output
235481754

user output
31600294579

Test 95

Group: 3

Verdict:

input
18 19 862859546 295948996
HUXPLFOMRUCMOUCHDUF
PJLIKDQODQEETRGXRMK
GRLIXKOARVFIOOCKHCQ
RJJXQPRDBBBVENXOQDN
...

correct output
936952574

user output
268349318807

Test 96

Group: 3

Verdict:

input
18 19 992294411 251454731
AAAAAAAAAABBBABAABB
AABBBABAABABAAAAAAB
BAABAAAABAABBABAABB
ABBBABBBBBAABABBAAB
...

correct output
879758473

user output
53583898198