CSES - Datatähti 2020 loppu - Results
Submission details
Task:Alueet
Sender:Roope Salmi
Submission time:2020-02-09 15:08:31 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED23
#2ACCEPTED24
#3ACCEPTED53
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 3details
#2ACCEPTED0.01 s1, 3details
#3ACCEPTED0.01 s1, 3details
#4ACCEPTED0.01 s1, 3details
#5ACCEPTED0.01 s1, 3details
#6ACCEPTED0.01 s1, 3details
#7ACCEPTED0.01 s1, 3details
#8ACCEPTED0.01 s1, 3details
#9ACCEPTED0.01 s1, 3details
#10ACCEPTED0.01 s1, 3details
#11ACCEPTED0.01 s1, 3details
#12ACCEPTED0.01 s1, 3details
#13ACCEPTED0.01 s1, 3details
#14ACCEPTED0.01 s1, 3details
#15ACCEPTED0.01 s1, 3details
#16ACCEPTED0.01 s1, 3details
#17ACCEPTED0.01 s1, 3details
#18ACCEPTED0.01 s1, 3details
#19ACCEPTED0.01 s1, 3details
#20ACCEPTED0.01 s1, 3details
#21ACCEPTED0.01 s1, 3details
#22ACCEPTED0.01 s1, 3details
#23ACCEPTED0.01 s1, 3details
#24ACCEPTED0.01 s1, 3details
#25ACCEPTED0.01 s1, 3details
#26ACCEPTED0.01 s1, 2, 3details
#27ACCEPTED0.01 s1, 3details
#28ACCEPTED0.01 s1, 3details
#29ACCEPTED0.01 s1, 3details
#30ACCEPTED0.01 s1, 3details
#31ACCEPTED0.01 s1, 3details
#32ACCEPTED0.01 s1, 3details
#33ACCEPTED0.01 s1, 3details
#34ACCEPTED0.01 s1, 3details
#35ACCEPTED0.01 s1, 3details
#36ACCEPTED0.01 s1, 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.01 s2, 3details
#54ACCEPTED0.01 s2, 3details
#55ACCEPTED0.01 s2, 3details
#56ACCEPTED0.01 s2, 3details
#57ACCEPTED0.01 s2, 3details
#58ACCEPTED0.01 s2, 3details
#59ACCEPTED0.01 s2, 3details
#60ACCEPTED0.01 s2, 3details
#61ACCEPTED0.01 s2, 3details
#62ACCEPTED0.01 s3details
#63ACCEPTED0.01 s3details
#64ACCEPTED0.01 s3details
#65ACCEPTED0.01 s3details
#66ACCEPTED0.01 s3details
#67ACCEPTED0.01 s3details
#68ACCEPTED0.01 s3details
#69ACCEPTED0.01 s3details
#70ACCEPTED0.01 s3details
#71ACCEPTED0.01 s3details
#72ACCEPTED0.01 s3details
#73ACCEPTED0.01 s3details
#74ACCEPTED0.01 s3details
#75ACCEPTED0.01 s3details
#76ACCEPTED0.01 s3details
#77ACCEPTED0.01 s3details
#78ACCEPTED0.01 s3details
#79ACCEPTED0.01 s3details
#80ACCEPTED0.01 s3details
#81ACCEPTED0.01 s3details
#82ACCEPTED0.01 s3details
#83ACCEPTED0.01 s3details
#84ACCEPTED0.01 s3details
#85ACCEPTED0.01 s3details
#86ACCEPTED0.01 s3details
#87ACCEPTED0.01 s3details
#88ACCEPTED0.01 s3details
#89ACCEPTED0.01 s3details
#90ACCEPTED0.01 s3details
#91ACCEPTED0.01 s3details
#92ACCEPTED0.01 s3details
#93ACCEPTED0.01 s3details
#94ACCEPTED0.01 s3details
#95ACCEPTED0.01 s3details
#96ACCEPTED0.01 s3details

Code

#include <bits/stdc++.h>
using namespace std;
const int M = 1e9+7;
const int N = 20*20*3*3;
int uf_p[N];
int uf_get(int i) {
  if (uf_p[i] == i) return i;
  return uf_p[i] = uf_get(uf_p[i]);
}
void uf_join(int a, int b) {
  a = uf_get(a);
  b = uf_get(b);
  // pienin edustaa aina
  if (b < a) swap(a, b);
  uf_p[b] = a;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, a, b;
  cin >> n >> m >> a >> b;
  int sa = min(3, a), sb = min(3, b);
  char t[sa*n][sb*m];
  int id[sa*n][sb*m];
  string ot[n];
  for (int i = 0; i < n; ++i) cin >> ot[i];
  for (int i = 0; i < sa*n*sb*m; ++i) uf_p[i] = i;
  for (int i = 0; i < sa*n; ++i) {
    for (int j = 0; j < sb*m; ++j) {
      id[i][j] = i*sb*m + j;
      t[i][j] = ot[i%n][j%m];
    }
  }
  for (int i = 0; i < sa*n; ++i) {
    for (int j = 0; j < sb*m; ++j) {
      if (i < sa*n-1 && t[i][j] == t[i+1][j]) uf_join(id[i][j], id[i+1][j]);
      if (j < sb*m-1 && t[i][j] == t[i][j+1]) uf_join(id[i][j], id[i][j+1]);
    }
  }
  int aos = max(1, a-2), bos = max(1, b-2); 
  long res = 0;
  for (int i = 0; i < sa*n; ++i) {
    for (int j = 0; j < sb*m; ++j) {
      int oid = id[i][j];
      if (uf_get(oid) == oid) {
	long mup = 1;
	if (i >= n && i < 2*n) mup = mup*aos%M;
	if (j >= m && j < 2*m) mup = mup*bos%M;
	res = (res+mup)%M;
      }
    }
  }
  cout << res << endl;
}
  

Test details

Test 1

Group: 1, 3

Verdict: ACCEPTED

input
3 2 4 5
AB
BA
AA

correct output
49

user output
49

Test 2

Group: 1, 3

Verdict: ACCEPTED

input
3 3 96 18
ABB
BAB
BBA

correct output
5298

user output
5298

Test 3

Group: 1, 3

Verdict: ACCEPTED

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

correct output
5887

user output
5887

Test 4

Group: 1, 3

Verdict: ACCEPTED

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

correct output
32162

user output
32162

Test 5

Group: 1, 3

Verdict: ACCEPTED

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

correct output
61567

user output
61567

Test 6

Group: 1, 3

Verdict: ACCEPTED

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

correct output
8609

user output
8609

Test 7

Group: 1, 3

Verdict: ACCEPTED

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

correct output
22191

user output
22191

Test 8

Group: 1, 3

Verdict: ACCEPTED

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

correct output
1317

user output
1317

Test 9

Group: 1, 3

Verdict: ACCEPTED

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

correct output
29879

user output
29879

Test 10

Group: 1, 3

Verdict: ACCEPTED

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

correct output
2105

user output
2105

Test 11

Group: 1, 3

Verdict: ACCEPTED

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

correct output
42565

user output
42565

Test 12

Group: 1, 3

Verdict: ACCEPTED

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

correct output
11638

user output
11638

Test 13

Group: 1, 3

Verdict: ACCEPTED

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

correct output
37889

user output
37889

Test 14

Group: 1, 3

Verdict: ACCEPTED

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

correct output
92814

user output
92814

Test 15

Group: 1, 3

Verdict: ACCEPTED

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

correct output
76704

user output
76704

Test 16

Group: 1, 3

Verdict: ACCEPTED

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

correct output
431101

user output
431101

Test 17

Group: 1, 3

Verdict: ACCEPTED

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

correct output
421004

user output
421004

Test 18

Group: 1, 3

Verdict: ACCEPTED

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

correct output
431100

user output
431100

Test 19

Group: 1, 3

Verdict: ACCEPTED

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

correct output
531102

user output
531102

Test 20

Group: 1, 3

Verdict: ACCEPTED

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

correct output
421001

user output
421001

Test 21

Group: 1, 3

Verdict: ACCEPTED

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

correct output
421302

user output
421302

Test 22

Group: 1, 3

Verdict: ACCEPTED

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

correct output
501500

user output
501500

Test 23

Group: 1, 3

Verdict: ACCEPTED

input
3 6 46 16
AABABB
ABAAAA
AABAAB

correct output
2257

user output
2257

Test 24

Group: 1, 3

Verdict: ACCEPTED

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

correct output
3626

user output
3626

Test 25

Group: 1, 3

Verdict: ACCEPTED

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

correct output
2010

user output
2010

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: ACCEPTED

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

correct output
120158

user output
120158

Test 28

Group: 1, 3

Verdict: ACCEPTED

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

correct output
476491

user output
476491

Test 29

Group: 1, 3

Verdict: ACCEPTED

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

correct output
520588

user output
520588

Test 30

Group: 1, 3

Verdict: ACCEPTED

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

correct output
3114342

user output
3114342

Test 31

Group: 1, 3

Verdict: ACCEPTED

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

correct output
3039795

user output
3039795

Test 32

Group: 1, 3

Verdict: ACCEPTED

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

correct output
1

user output
1

Test 33

Group: 1, 3

Verdict: ACCEPTED

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

correct output
4000000

user output
4000000

Test 34

Group: 1, 3

Verdict: ACCEPTED

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

correct output
2000

user output
2000

Test 35

Group: 1, 3

Verdict: ACCEPTED

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

correct output
2000

user output
2000

Test 36

Group: 1, 3

Verdict: ACCEPTED

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

correct output
2000

user output
2000

Test 37

Group: 2, 3

Verdict: ACCEPTED

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

correct output
0

user output
0

Test 38

Group: 2, 3

Verdict: ACCEPTED

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

correct output
758647118

user output
758647118

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: ACCEPTED

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

correct output
472691105

user output
472691105

Test 41

Group: 2, 3

Verdict: ACCEPTED

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

correct output
295196654

user output
295196654

Test 42

Group: 2, 3

Verdict: ACCEPTED

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

correct output
442321725

user output
442321725

Test 43

Group: 2, 3

Verdict: ACCEPTED

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

correct output
716146536

user output
716146536

Test 44

Group: 2, 3

Verdict: ACCEPTED

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

correct output
253581266

user output
253581266

Test 45

Group: 2, 3

Verdict: ACCEPTED

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

correct output
77125475

user output
77125475

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: ACCEPTED

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

correct output
808192912

user output
808192912

Test 48

Group: 2, 3

Verdict: ACCEPTED

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

correct output
288258811

user output
288258811

Test 49

Group: 2, 3

Verdict: ACCEPTED

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

correct output
505128429

user output
505128429

Test 50

Group: 2, 3

Verdict: ACCEPTED

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

correct output
581615816

user output
581615816

Test 51

Group: 2, 3

Verdict: ACCEPTED

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

correct output
710889751

user output
710889751

Test 52

Group: 2, 3

Verdict: ACCEPTED

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

correct output
742500534

user output
742500534

Test 53

Group: 2, 3

Verdict: ACCEPTED

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

correct output
778639448

user output
778639448

Test 54

Group: 2, 3

Verdict: ACCEPTED

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

correct output
419006017

user output
419006017

Test 55

Group: 2, 3

Verdict: ACCEPTED

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

correct output
890540889

user output
890540889

Test 56

Group: 2, 3

Verdict: ACCEPTED

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

correct output
255155281

user output
255155281

Test 57

Group: 2, 3

Verdict: ACCEPTED

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

correct output
206554828

user output
206554828

Test 58

Group: 2, 3

Verdict: ACCEPTED

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

correct output
376450413

user output
376450413

Test 59

Group: 2, 3

Verdict: ACCEPTED

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

correct output
196798982

user output
196798982

Test 60

Group: 2, 3

Verdict: ACCEPTED

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

correct output
722651706

user output
722651706

Test 61

Group: 2, 3

Verdict: ACCEPTED

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

correct output
142366580

user output
142366580

Test 62

Group: 3

Verdict: ACCEPTED

input
3 3 456113515 704946263
AAA
ABB
ABA

correct output
652295842

user output
652295842

Test 63

Group: 3

Verdict: ACCEPTED

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

correct output
476592507

user output
476592507

Test 64

Group: 3

Verdict: ACCEPTED

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

correct output
391556003

user output
391556003

Test 65

Group: 3

Verdict: ACCEPTED

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

correct output
854669536

user output
854669536

Test 66

Group: 3

Verdict: ACCEPTED

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

correct output
875048540

user output
875048540

Test 67

Group: 3

Verdict: ACCEPTED

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

correct output
474035030

user output
474035030

Test 68

Group: 3

Verdict: ACCEPTED

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

correct output
863729741

user output
863729741

Test 69

Group: 3

Verdict: ACCEPTED

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

correct output
212637108

user output
212637108

Test 70

Group: 3

Verdict: ACCEPTED

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

correct output
406709536

user output
406709536

Test 71

Group: 3

Verdict: ACCEPTED

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

correct output
160362600

user output
160362600

Test 72

Group: 3

Verdict: ACCEPTED

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

correct output
162292142

user output
162292142

Test 73

Group: 3

Verdict: ACCEPTED

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

correct output
27244656

user output
27244656

Test 74

Group: 3

Verdict: ACCEPTED

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

correct output
433164344

user output
433164344

Test 75

Group: 3

Verdict: ACCEPTED

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

correct output
976798562

user output
976798562

Test 76

Group: 3

Verdict: ACCEPTED

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

correct output
884411688

user output
884411688

Test 77

Group: 3

Verdict: ACCEPTED

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

correct output
528861784

user output
528861784

Test 78

Group: 3

Verdict: ACCEPTED

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

correct output
179830991

user output
179830991

Test 79

Group: 3

Verdict: ACCEPTED

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

correct output
1

user output
1

Test 80

Group: 3

Verdict: ACCEPTED

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

correct output
19600

user output
19600

Test 81

Group: 3

Verdict: ACCEPTED

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

correct output
448258360

user output
448258360

Test 82

Group: 3

Verdict: ACCEPTED

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

correct output
229302842

user output
229302842

Test 83

Group: 3

Verdict: ACCEPTED

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

correct output
128441960

user output
128441960

Test 84

Group: 3

Verdict: ACCEPTED

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

correct output
574186338

user output
574186338

Test 85

Group: 3

Verdict: ACCEPTED

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

correct output
424550984

user output
424550984

Test 86

Group: 3

Verdict: ACCEPTED

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

correct output
480469347

user output
480469347

Test 87

Group: 3

Verdict: ACCEPTED

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

correct output
323992721

user output
323992721

Test 88

Group: 3

Verdict: ACCEPTED

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

correct output
521981688

user output
521981688

Test 89

Group: 3

Verdict: ACCEPTED

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

correct output
627592320

user output
627592320

Test 90

Group: 3

Verdict: ACCEPTED

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

correct output
851646723

user output
851646723

Test 91

Group: 3

Verdict: ACCEPTED

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

correct output
890991727

user output
890991727

Test 92

Group: 3

Verdict: ACCEPTED

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

correct output
590655675

user output
590655675

Test 93

Group: 3

Verdict: ACCEPTED

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

correct output
259160804

user output
259160804

Test 94

Group: 3

Verdict: ACCEPTED

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

correct output
235481754

user output
235481754

Test 95

Group: 3

Verdict: ACCEPTED

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

correct output
936952574

user output
936952574

Test 96

Group: 3

Verdict: ACCEPTED

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

correct output
879758473

user output
879758473