QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#127199#3156. JOI EmblemKKT89100 ✓51ms4488kbC++14706b2023-07-19 14:02:572023-07-19 14:03:01

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-19 14:03:01]
  • 评测
  • 测评结果:100
  • 用时:51ms
  • 内存:4488kb
  • [2023-07-19 14:02:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
char s[1010][1010];
string p,q;
string b="JOI";
int ans,res;
int cnt(int x,int y){
	if(s[x][y]==p[0]&&s[x][y+1]==p[1]&&s[x+1][y]==q[0]&&s[x+1][y+1]==q[1]){
		return 1;
	}
	return 0;
}
int sq(int x,int y){
	return cnt(x-1,y-1)+cnt(x-1,y)+cnt(x,y-1)+cnt(x,y);
}
int main(){
	int h,w; cin >> h >> w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin >> s[i][j];
		}
	}
	cin >> p >> q;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			ans+=cnt(i,j);
			int v=sq(i,j);
			for(int k=0;k<3;k++){
				char cp=s[i][j];
				s[i][j]=b[k];
				res=max(res,sq(i,j)-v);
				s[i][j]=cp;
			}
		}
	}
	cout << ans+res << endl;
}


详细

Subtask #1:

score: 30
Accepted

Test #1:

score: 30
Accepted
time: 1ms
memory: 3540kb

input:

4 5
OIJOO
JIIOO
JOJJO
IOJOO
JO
IO

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3400kb

input:

3 4
OOOO
OOOO
OOOO
OO
OO

output:

6

result:

ok single line: '6'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

6 4
OIOI
OIOI
OIOI
OIOI
OIOI
OIOI
II
OO

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

7 7
JJJIJJJ
JOIIIOJ
JIOOOIJ
IIOJOII
JIOOOIJ
JOIIIOJ
JJJIJJJ
JI
JI

output:

2

result:

ok single line: '2'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

8 8
OOJJOOJJ
OOJJOOJJ
JJOOJJOO
JJOOJJOO
OOJJOOJJ
OOJJOOJJ
JJOOJJOO
IJOOJJOO
JJ
JJ

output:

8

result:

ok single line: '8'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3388kb

input:

6 6
IJIIJJ
OJIOJI
JIJIJJ
IIOIII
OOJJJO
JIOJJI
II
OI

output:

1

result:

ok single line: '1'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

7 9
IIOIOIIOO
JJJJIIIJJ
IJIIJIIJO
IJOIIOOIO
IIOIIIIIO
IIIJIIIOO
IOJOJJOOJ
OI
JJ

output:

2

result:

ok single line: '2'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3412kb

input:

4 10
OJOOIIJJOO
JIIJOJJOIJ
JJIOIJIJJJ
JOJJIIJIOI
JI
JO

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3396kb

input:

10 10
IJIIOOJJOJ
IJJIOIIJOO
JIIOOIIJII
IJOIJOJOII
OIJJIJIOJJ
JIJOOOOIIJ
IOOIIIJOOJ
IOIOJOIJJJ
JIJIIIIIII
OIIJIJIIOI
OI
OI

output:

2

result:

ok single line: '2'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3404kb

input:

10 10
JOJOOJIOJO
JIOIIIIOIO
OIOOOOOIJJ
OIOJOIJOOJ
OOJJIJIOJJ
OIOJOIJJOI
OOOJIOIIJJ
IIOIJJJOJJ
JOIOOIJOJI
JIJJOIOOOI
JO
JJ

output:

2

result:

ok single line: '2'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

12 12
IOJJIIOIOIOI
IOOOOJJOJOIJ
OJJJJJJOJOOI
IOJIOOIJOOJI
OJJIOOOIOIIO
IIOOIIJJJOOO
JOIJJOIIOIOI
OIJIOJJJOOOI
JOIJOIJJJIJO
OIJJOJOIOOIO
OOIJIJIJIOJO
OOJOOIOOOJII
II
II

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

20 18
JIIIIJJJJOOJJIIOOO
IOJOJIJJOOOOOIJJOO
OJIJJJIJOOJJIIIOIO
JJOOIJOIIIOOJIJIOJ
OOIOOIJJOJOIOJIOII
IIOJJIOOOJOJOIIIJI
IJIJIOOOIOIJOOJIJO
IIOOIIIIOJIIOIJIOO
OJIIJJJJJIOOOJOOIO
OJOOIJJOJOIJIJOOOJ
IOOIOOIOOJIIIIIIII
IOOJOIJIOOOIJIOOIJ
JOJOJOJIJJJIOOOOJI
JOJJOOJOOIJOOOIOOJ
JOJJOIOOOJJOJOJJJJ
IIOOJJIJI...

output:

3

result:

ok single line: '3'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3372kb

input:

25 30
IIIIOOOIIIOOIIIIOIIIIIIIOOIIIO
IOIIIOOOIOOOIIIIIOIIIIIOIIIIII
IOIIIOIIIOOOIIIIIIIIOOIIOIIIOI
OOIOIOIOOOIIIIIOIIIIOOOIIIOIII
OIIOIOOIIIIIIOOIIIIIIOOIOOIIOI
OIOIIIIIOIIIIOIIOIIIOOOIOOOOII
IIIIIIOIOIIOOIIIIOIOIOIOIOIIII
IIIIIIIOOIOIIIOIIIOIOIIOOIIIOO
IOIIIIOIIIIIOIOIIIOIIIIOOOOIOO
IIIIOIOOOOIOIII...

output:

0

result:

ok single line: '0'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3396kb

input:

30 30
IJJJJIJJJIIJIIJOOOJJJIIJJIIIII
OJIJOIIOJOJIJJIOIJJJIJOJOJOJJO
OJJIJJOOJIIIJIJOIIOJIJOIIOJIOO
OJOJIIOJJIIIJOOIJIOIOOIJJIJIII
JJJJIIIOOIJIIJIJOOIJOIIIOJJIOJ
IIIJOIJIIJIJIIJIIJJJJOIJJOJIIO
JJOIIJJJOIOOJIOOJJJJIOJIIOJJOO
IIIJIJIIIJIJIJJOOIJIIOJJOOJOOI
JJIJIOJOIOJOIJIJJJIOOOOOOIJIOO
IIJIOOJIJIJIIJO...

output:

14

result:

ok single line: '14'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

40 40
OIOOOIOJIOOJOJIIIJJIOIJIIJOJJOOOIOIOOJJI
JIOJJOJOOOOIIJOJOOIIJJJJIJIIIIIJJOJOJJIJ
OIIJOJJIJIOIOJOOOOIOOJIJIJIOOIOIIIJOJJJI
JOJOJJIJIOIJJJIJIIJIOIIIOJJJIOJIOIIOIJIO
JOJIOOIJIJJIIJJOIOIJIOOIOIIIJOIOJOOJIOJO
IOOOJJIIOOIJJJIIIOOJIOJIIIIJJJJIIOIIIOJI
JJOIJIIIJOIOOJJOIJIJIIOOOJJIJIOJIIJIJOOI
OJJIOOJ...

output:

20

result:

ok single line: '20'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3580kb

input:

50 50
JJOOJJOJOJOJOJOJJOOOJJJOOOJOOOJJJOJJJJOJJJJJJJJOOJ
OJJOJJOOJJOOOJJJOOJJOJOJOJJOJJJJOOOOJOOOJJJOJJJOJJ
JJOOJOJOJOOOOOOJOOJOJOOJJOOOOJOOJJOJJOOOJJOJOOJJOO
JJJJJJJJJOJOOOJOOJJOJOJOJOOOJOJOJOOJOOOJOJOJJOOJJJ
JOJJOJJOOJOJJOOOJJJJOJOOJJOOOOJOOOOJOOOOOOOJOJJJJO
JJJOOOOOOOOJOJOOJJJJJJJOJOOOOJJOOOJJJJJ...

output:

168

result:

ok single line: '168'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3448kb

input:

50 50
JOOOJOOOOOOOOOOOOJOOJJOOOOJJJJOOJJJJJJJJJOOJJOJJJJ
OOOJJOJJOOJJOJJOJJJOJOJJJJOOJJJJOOOOJJJOOOJOJOJOJJ
JJOOJOOJJJJJOOOOOOOJJOJJJJOJOJJOJOOOOJJJJOJJOJOJJJ
OOOOJJJOOJJJOJOJOJOOJJJJJJJJJOOJOOJJJJOJOJOOOJJOJJ
OOOJOOJJJJOJOJJOJOOOJJOJOOOOOJOJOJOOJJJJOOOJOOOOJJ
OOJJJOOJJJOOJOOOOOOJOJJOOJOJOOJJOOOJOJO...

output:

141

result:

ok single line: '141'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

50 50
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IJOJJOJOOOOOOJOJJJOJOJOJOJJJJJOOJJOJJJJJOOOJOJOOJI
IOJOOOJOOOJJJJJOJOJOOOOJOJJOOOOJJOJJOOJOOJJOOOOOOI
IOJJOOOJOOOOJJOOOJOOOOJJJOOOJJJJJJOOOOJJJJOOOJOJJI
IJJOOJOJJJJJJJOOOJJJJOJOOJOOJOJOJOOOJJOOOJJJOOOJOI
IJOJOJOJOJOOOJOOJJOJOJJOOOOOOJOJJJJJJJJ...

output:

8

result:

ok single line: '8'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

50 50
OJOOIJIOIIOJIOIJJIIJOJJIOOJJIIOJJIOIOOIJJOOIIOJIJO
IOJOIIIOOIIJJJIJJOIIJJOOOOJIOJJIJIIJOOOOIOJJIIJIOO
IIOIOOOOIJOJIOOOOIJOIIIOJIJOIOOIOOJJIIIJOJJJJJIOJJ
JIJOJIJIOJOJJOJOJJIIOIIIIJIIOJJOIIIOJIJIOIJIJIIIJI
JOJOJOJOOIOIIOJJJIOOOOOOOIJOOJIOOOOIOOOIJJJJIJJJII
IOIJJOOJOOIJIIOJJIOIJOOOIIIIIJJOOIIOOOO...

output:

36

result:

ok single line: '36'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3408kb

input:

44 50
OIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJI
IIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJI
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJI
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJI
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJI
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

2

result:

ok single line: '2'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

50 50
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJO
JIIIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJOI
JIOIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJOII
JIIIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJOIII
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJOIIII
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

1116

result:

ok single line: '1116'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

50 50
OOOOOOJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
OOOOOOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJO
OOOOJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
OOOOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJO
OOJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
OOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJOJ...

output:

619

result:

ok single line: '619'

Subtask #2:

score: 70
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 70
Accepted
time: 1ms
memory: 3376kb

input:

4 8
OOOIOOJO
JJIOJIOO
OJOIOJJO
IOIIJOJJ
OO
OI

output:

1

result:

ok single line: '1'

Test #24:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

5 7
JIIOJOI
OOIIIII
JIOIIOJ
OOJJIIJ
JJJIIII
II
OJ

output:

2

result:

ok single line: '2'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3452kb

input:

10 10
OJOJOJJJOJ
OJJJJOJOOO
JOJJOJJOJJ
OOOJOOOJOJ
OJJOJJJOJO
OOJJJOOJOO
JJJJJJOOJO
OJJOJOOOOJ
JOJOJJJOJJ
JOOOOJJJJO
JO
JJ

output:

8

result:

ok single line: '8'

Test #26:

score: 0
Accepted
time: 1ms
memory: 3516kb

input:

16 16
JJJJJJJJOOOOOOOO
JJJJJJJJOOOOOOOO
JJJJJJJJOOOOOOOO
JJJJJJJJOOOOOOOO
JJJJJJJJOOOOOOOO
JJJJJJJJOOOOOOOO
JJJJJJJJOOOOOOOO
JJJJJJJJOOOOOOOO
IIIIIIIIJJJJOOOO
IIIIIIIIJJJJOOOO
IIIIIIIIJJJJOOOO
IIIIIIIIJJJJOOOO
IIIIIIIIIIIIJJOO
IIIIIIIIIIIIJJOO
IIIIIIIIIIIIIIJO
IIIIIIIIIIIIIIIJ
JO
IJ

output:

4

result:

ok single line: '4'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

45 44
IIOJIIOIIJOIOOIOJJJOIIOIJIJJOIJOIOJJIJJOOOOJ
JIOJIOOOOOOJIIJOIIJIIJJIOIJIIOJIIIJOOIIJJOII
OIJIIJJJJOJJOJIIJOIIIOJIIJJJJOOOIOOJIJJOJIIJ
IIJOOIIOIOIOIOJOIOIOJIOOIJIOJIIIJIOIOJJIOOOO
IOOJIJOIOIOJJJJIOIJJIOJOIJOOJJIIOIOJOIIOIJOI
IOJJOOJIIIIOIIOJJJOIJJOIJOOJJIIOOOIIIOOJOIII
IOJJIIIJOIOOIJOJJIOOIIJO...

output:

29

result:

ok single line: '29'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

50 50
JJOJJOJOJJOJOJJJJOJJOJOOJJJOOOOJOOJJJJOJJJJOOOOJJJ
JOJJOOJOJJJJOOJOJOJOJOJJOJOOJJJOJJOJOOOOOJJOJOOOJO
OJJOOOJOOJOOOOOOOJJJOOOJOJJOJOOJJOOJJOOOJJJOJJOOOO
OOOJJOOOJOJOJOJOOOJOJOOJOJOOOJOOOOOOJJJOJJOOOJJOJO
JJJJJOOOJOOOJJOOOOJOOJOJOJJOOJOJOJJOOOJOOJOOJOJOOJ
OOOOOJOJOJOOJOJJJOOJOOJJJJJOOJJOJJJJJJO...

output:

160

result:

ok single line: '160'

Test #29:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

50 50
OIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

2401

result:

ok single line: '2401'

Test #30:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

100 100
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ...

output:

0

result:

ok single line: '0'

Test #31:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

100 100
OJIOJJOJJOOIOOOIIJIIIOOOJOIIIIIIOOJJIIIOJOOIOJJOJOJIOIIIIJIJOIJIJIIOOIJIIIIJJJIJJJOOOJOOIJOIIIOJIOII
JIIOIJIOOOOJIOOIIIJJJJIOIIJIJJOIIOIJJJIIIOJOJJIJOJJIJOOIOJJIOIIOOIJIOOOIIOJJIIOIJOIIJOJIIJOJOOIIOJOJ
JJJOIOOIIIOOOJJOOJIJOJOOJJOJJIOIOOIJJJJIOJIJJIIOOOOOIIOOIJOOOIJIJJIIJJOJJJJOOIOIOJIIOIJIJJ...

output:

131

result:

ok single line: '131'

Test #32:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

97 99
OIIOJJIOIIIJOIJIJOJIJOOJJOOJIJJJIJJOIJOOOJIOOOJJIJOJIJOOJJJIIIJIOIOOOJIJOOIIIOIOOOJIIIOOIIJIOJOJOIO
IIJOIJIIJIJIIIJJIOOIJIIJOOJOIOOIIJJOOIOJOOOJIJOJOIIOJJIOJIJJIOIOOIIIIOIOJJIJJJOIOIJJJIOJOIOJJJOOJJJ
IJJOOIIIJJIIIOJJIJJIJIIOOOIOJOJIOIJJJIJJOOOIJOOIIIIOJOOJOIJIIOIIOIIIOIJOOIOIIIJIIOIOOOJIOOIJIJ...

output:

120

result:

ok single line: '120'

Test #33:

score: 0
Accepted
time: 2ms
memory: 3540kb

input:

100 100
JJOJJOJOJOJJJOOJJOOOJOOJOOOJJJJJJJJJJOOOJJOOOOOOOJOJJJOOJJOJJJOOOOOJOJOOJJOJOJOOOJJOJJJJOOJOOOJJOJJJ
OOJOOJJJJOOOJOJJOJOJOJOJJOOOOJOJJJJJJOJJJOOOJJOJOOJJOJJOOOJOOJJJJJJJJJJOJJOJJJJJOJOJJOOJJJJJJJOOOJOO
OJOOOOOJOJJJJJOOOJOJJJJJJJJJJJJJJJOOOJJOOJJJOJOJJOOJOOJJOJJOOOJJOJOOJJOJOJJOJOOJOOJOJOJJOJ...

output:

598

result:

ok single line: '598'

Test #34:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

3 3
OOO
OJO
OOO
OO
OO

output:

4

result:

ok single line: '4'

Test #35:

score: 0
Accepted
time: 1ms
memory: 3376kb

input:

2 2
OI
JI
OO
JO

output:

0

result:

ok single line: '0'

Test #36:

score: 0
Accepted
time: 1ms
memory: 3488kb

input:

100 100
OIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOI
IOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIO
OIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOI...

output:

4900

result:

ok single line: '4900'

Test #37:

score: 0
Accepted
time: 3ms
memory: 3640kb

input:

200 200
JIJIJIJIIJIJJIJJJJIJIJIIJJJJIJJJIJIIIJIJJIIJIJJJIJJIJJJJJJJJJJJIJJJJIJJJIIIJIJJJIIIIIIJJJIIIJIIJIJJIJIIJIJJIIIIIIJJIIIIIJIJJJIIJJIJIIIJJIIIIJJIJJJIJIJIJIJJIJJJJJJJIIJIJIIJIJIJJJIJIJJIJIIIIJJIJIIJJIJIJ
IIJIIIJJJIJJJIJJIJJJJIJJJIIIIJJJIIIJIJJJJIJJJIIIJIJIJJIIJIJJIJIJJIIIJIJJIIJIJJJJIIIJIJJJIII...

output:

0

result:

ok single line: '0'

Test #38:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

200 200
JIIIIIIIIIIIIIIIIIIIOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIOIIIIIIIIIIIIIIIIIIIIIJIOIIIIIIII...

output:

742

result:

ok single line: '742'

Test #39:

score: 0
Accepted
time: 3ms
memory: 3564kb

input:

200 200
IJJJJJJJIIJIJIIIIIIIIJIIIIIIJIIJJIJJJJJIIIIJJIIJJJIIIJIIJIIJJJIJJIIIIIIJIIIIJIIIIJIIIJJJJJIJIJIIJJIJIIIJJJIIJIJJJIJIIIIJJJIJJIIJIIJJJIJJIJJIJIJJJIJJIJJJIJIIJJIIJIJJIIJJJIJIIIJIIJJJJJIJIJJJJJJIJJIJIJJI
JJJIJJJIJIIIJJJJIIIJIJIJIJIIIJJIIJJJJIJJJJIJIIIJIIJIIIIIJIIIJJJIIJJJIJJJJJJIJIJIJJIJIIJJJJJ...

output:

2467

result:

ok single line: '2467'

Test #40:

score: 0
Accepted
time: 3ms
memory: 3728kb

input:

200 200
OOOIOOOIOOIJJOJJIOOJIOOIIOOJJIJOIIOJIIJJIOJIJOIOOJJOJIJOIIJJJIIOIOJIOOJJJIIIJJOOJOJJJJIIJIJJOIIJJJOOIOJIIJJOOJOOJIOIJIJOJOJOJOIOIIOOOIIIOOIOOOJJJOOJJIOOIJJOIOJOIJJIJIJOOJOOJIJIOJJJIOJJOJJIIJJOJJIIJJOJ
OJIOIIOIOIOJIOIIOIJIJIJOJJJJOJJJIIOJJIJOJJOJOOIOJOOJJIIOIJIJIIIJIOOJOJIIIIJJJJJJJJIIOJOJJJI...

output:

497

result:

ok single line: '497'

Test #41:

score: 0
Accepted
time: 34ms
memory: 4488kb

input:

1000 1000
JJJJJJJJJOOOJOOOJJOOJOOOJJJOJJOOJOJOJJOJOJJJJOOOOJJJOJOJJOOJOJJJJOJOOJOOJOOJJJJOOJOJOOOJOJOOJJOJJOOJOOOOOOOJJOJJOJOOOOOOOJJJJOOJOJOJJJJOOOOJJJJJOOOOOOOJOJJOJJOJOOJJOOOOOJJOOJOOJJJJJOJOOJJOJOOJOOOJOJJOOJOJOJJJOOOJOOJJOJJJOJOJJOJJJOJOJJJOJJJJOOOJOJOJOJOJOOJJOOOJOJOOJJOOJJJJOJJJOJJOOJOOJOOOOO...

output:

0

result:

ok single line: '0'

Test #42:

score: 0
Accepted
time: 49ms
memory: 4368kb

input:

1000 1000
IIOIOOOIIOIOOOIOIIOOOIIIOOIIOIIIOIOOOOOOIOIIIOOIIIOIOOIIIOOIIIOOOIOIIIIIIOIOOIOIOOIOIIIOIIIOIIIOOIOOIIIIOIIIOIIIIIIOIIOOOOOIIOIIOIIOOOIIOIOIIIIIOIOIIOOOOIOOIIOIOOOIOOOOOIOOOOOIIOOOOOIOIIIOIIOIIIOIOIIIOOIOIOIIIOOOIIIIOOOIIOIOIOIIOIIIOOOOOOIOIIIIIIIIIIOOOIIIOIIOIIOIOIIIIIIOIIIIIIIIOIIIIOOOOO...

output:

62051

result:

ok single line: '62051'

Test #43:

score: 0
Accepted
time: 36ms
memory: 4416kb

input:

1000 1000
IJOJJJIJIIOIOOOIJIIJOOOJOIIIOOOIIIOOOIIJJJJOOOOOJOJOOIOIOOIJOOJIIOJJIJOIJOOJIJOJJOIOOOJIJJJIOOIIIOJOJJIOJIJJIIJJJJOIJOOJJJOIOOJIIIIIOJJJJOJJIOIOIJJIIOIJIIOIOOIJJOOJJJIIIJIOIOJIOOJIJJJJIJOIJOIJJOOJOJIOJOJIIOIIIOIIIIJJOJOOIIIJOIIOOIJIJIJIOOIIJJIJOIJIJOJIOJJOJJJIOJIIOJJIJIIJIJOIIOJOIJIIIIIOIJ...

output:

12238

result:

ok single line: '12238'

Test #44:

score: 0
Accepted
time: 37ms
memory: 4376kb

input:

1000 999
IOOOOOOOOOOOOOOOOOOOOOOOJOOOOOOOOOJOOOOOJOJOOOOOOIOOOOOOOOOJOOOOOOJOOOOOOOOOOOOOOOOOOOJOIOOOJOOIOOOOOOOOOOOOOOOOOJOOOIOOOOOOOOOOOOOOOOOOIOOOOOOOIOOOOOOOOOOOOOIOOOOOOOOOOOOOOOOOOIOOOIOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOIOOOOOOOOOJOOOOOOOOOOOOIOOO...

output:

0

result:

ok single line: '0'

Test #45:

score: 0
Accepted
time: 46ms
memory: 4412kb

input:

999 1000
JOOOOJIIIJOOIOIJOOJIIOIIJJOJJIIIIJJJOJJIJOJIJJJOOJIJJIJIJJJJOOOJIIIIOJIIJJOOJIJIIOJOJJOIJJOJOOJOIJOJOJOIIIJOIIIOIJJIIJOJJIJIJOJJJOOIIIIJOIJOOOIJOOOJJIJJJOJIJOJJJJJJIOOJOOJIIOIOJIOJOJJIOIJJJJJIJJJIIJIIIIIOOOJOOIIOJIOJIJOJOJIOIJJIIIJIOOIOOJOJOIOJJOJIJOJOJIJIJOOJOJIOOJOJJIIIIJOIJIJIIIOIJOJJOIO...

output:

12244

result:

ok single line: '12244'

Test #46:

score: 0
Accepted
time: 51ms
memory: 4396kb

input:

1000 1000
OOOIOIOIIOIOOIOIOIIOOOIOOOOOOOOIIIOIIIOOIOOOOOIIIIOIOOIIIOIOOIOIIOOIIOIOIOOIIOOOOOIIIIOIIOOIIIOOIIIOIOIIIOIIIIOOIOIOIIOOOIIOIOOOIOIOIOIOOOIIIOOOOIIOOOIIOOIIIIOIOOOOOIIIOOOIOOOOIIOIIIIOOIIIOIIOOOIIIIIOIOOOIOOIIOOOIIIOOIIOOIIIOIIOIIOIIOIIOOIOIIIIIOOOOOIIOOIOOIOOOOOIOOIOIIOOOOOOIOIOOOOOIIOOOI...

output:

62246

result:

ok single line: '62246'

Test #47:

score: 0
Accepted
time: 35ms
memory: 4352kb

input:

1000 1000
OJOJJJJJIJJJJJOJOJIOJOJJJJJOJJOJJIJIJJIJJJJJJJJJJIJJJJJJJIJJOIJJOOJJJJJIOJOJIJJJJIOIJJJIJJJJJJJJJJJOOIJJIJJJJJJJJJIJJJJJJJIJJJIJOOOIJIIJJJOIJJJJOJJJJJOJJJIJJIJJJJJJJJJJJIJJJJJJJJJIJOJJJJOIIJJIJJIJJJJJJIOJIJIIJJJJIJJIIJIOJIOJOJJJJIJIJIOJJJJJJJJJIIJJIJJJOIJJJJJOJIJJOJJOIJOIJJOJIOJJOJJIJJJJJJ...

output:

742

result:

ok single line: '742'

Test #48:

score: 0
Accepted
time: 45ms
memory: 4348kb

input:

1000 1000
OJOJIIIIJIIJOIIJIIOJJOOJIIIJJJOOJJIIJOJJOJIIJOJOIIIOOJIIJIIIOOJJIJJIOJJIOJOOOJOIOOJIIJJJJOJIOJIOOIOIIJOOIJIIJOIJOJOJJOJIJJIJOJIIJOIIIIOJOOJIIIJOJIJOJOJOIIJOOIOIIJOIOIJOJOJJIOIIOOJIJJJJIIIJOOJJOJIJJJJJIOJOJJOIIJOIOOJOIOJIIJIIJIJJJJIJOJJIIIIIIOJIIJIJJIIJIOJJIJJIJIIIIOOOIIIIIJJOJIIIOOJIOJJIOO...

output:

0

result:

ok single line: '0'

Test #49:

score: 0
Accepted
time: 45ms
memory: 4396kb

input:

1000 1000
OIOJJJJJIIOOIOJOIJIJOIIIIJJOJJIOOIIOOOJOIIOJIOOIOIJIJJJJJJJIIIOOJIIOOOJOOIJIIJJIJJIOJJJOIOJJJIOOJIOOIOOJJIJIOOIIIOOJJIIOJIOOOIOOIIJJIJIOJJIJIOJIIOOJIOOOJIIJIJIJOIIJIIOIOJIJOJIOIIOJIJIIJJIIIIIIOOOJOIIIJJJIIOOIIOJOIIOJOOOOIJOIOJOIJJJOOOOOIOOOOOJOIIJIJOJIOOOJIOJOIIJIJOOIJJIJOJOOJIIOIOIOJIOIOJ...

output:

12397

result:

ok single line: '12397'

Test #50:

score: 0
Accepted
time: 42ms
memory: 4412kb

input:

1000 1000
IIOOIOOIIIOOIIIIOOIOIOIIOOIOOIIIIIOIOOOIOIOOIIOOIOOOOOIIOIIOOIIIOIIIOIOOIIIIOIIOIOIIOIOIIIOIIIIIOIIIIIIIOIIOIIIOOIIIOIIIIOOIOOIOOOIOIOOIOIIIOOOOIIOIIIOIIIOOIOOOIIIIIOIOIIOIIOIIOOOIIIOIIIOOOOIIOIOOOOIOIOIIOOIIIIOIOOOOOOOIIIOOIOOOOOOOIIIIIOIIIOOOOIIOOIIIOOOIIIOIIIOIOOIIOIOIIOIOIOOIOOIOIOOIIO...

output:

62650

result:

ok single line: '62650'

Extra Test:

score: 0
Extra Test Passed