QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#184095#2030. Paint by Letterspaul2008#10 30ms6692kbC++141.0kb2023-09-20 12:37:452024-07-04 02:05:18

Judging History

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

  • [2024-07-04 02:05:18]
  • 评测
  • 测评结果:10
  • 用时:30ms
  • 内存:6692kb
  • [2023-09-20 12:37:45]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N=1005;

bool can[N][N];
char a[N][N];
pair <int,int> q[N*N];
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};

void bfs(int x,int y,char t)
{
	int l=1,r=0;
	can[x][y]=false, q[++r]=make_pair(x,y);
	while(l<=r)
	{
		int x=q[l].first,y=q[l].second;
		l++;
		for(int i=0;i<4;i++)
		{
			int newx=x+dx[i],newy=y+dy[i];
			if(can[newx][newy] && a[newx][newy]==t)
				can[newx][newy]=false, q[++r]=make_pair(newx,newy);
		}
	}
}

int main()
{
	int n,m,q;
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> m >> q;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin >> a[i][j];

	for(int i=1;i<=q;i++)
	{
		int x1,y1,x2,y2;
		cin >> x1 >> y1 >> x2 >> y2;
		memset(can,0,sizeof(can));
		for(int i=x1;i<=x2;i++)
			for(int j=y1;j<=y2;j++)
				can[i][j]=true;

		int ans=0;
		for(int i=x1;i<=x2;i++)
			for(int j=y1;j<=y2;j++)
				if(can[i][j])
					ans++, bfs(i,j,a[i][j]);

		cout << ans << endl;
	}
	return 0;
}

詳細信息

Test #1:

score: 5
Accepted
time: 1ms
memory: 5860kb

input:

4 8 9
ABBAAAAA
ABAAAABA
CAADABBA
AAAAAAAA
1 1 4 8
3 5 3 8
1 3 2 4
1 4 2 5
1 1 3 3
4 4 4 4
2 6 4 8
3 5 4 6
1 6 3 8

output:

6
3
2
1
4
1
3
2
2

result:

ok 9 lines

Test #2:

score: 5
Accepted
time: 30ms
memory: 6636kb

input:

50 45 1000
BBBAAAAABBABAABBBBAABBBBABBAABBAABABBBBBBABAB
BABABBBAAAAAAABAABABBBAABABBBBABABBBABBBBBABA
ABBAAAABAABBBABABBAABBBBBAABAAABAABABAAAABAAB
BBABBABABAAABBAAABBABBABABABAAAAAAAAABAAAABBB
BBABBBABBAAABBBAABBAABAAABBBBBBBBAABABBBBABAB
BABABAAAABBBBBBABBABAAABBAAABBBBBBABBBABBAABB
BBAAABAAAAAAA...

output:

40
26
121
20
23
85
12
247
51
24
17
13
48
29
35
6
19
2
26
26
158
100
18
46
36
42
28
9
149
119
4
5
65
105
23
57
30
14
39
43
44
83
17
1
29
41
10
10
33
132
30
21
39
10
16
38
127
57
22
177
15
6
84
65
17
21
28
44
14
22
44
32
96
34
9
1
98
31
35
94
79
16
80
17
30
20
20
49
50
55
9
29
6
37
16
30
14
36
88
5
58...

result:

ok 1000 lines

Test #3:

score: 0
Time Limit Exceeded

input:

1000 1000 1000
JBBBJQJJBJZJJJSJWJJLJJJJJYJJDJDJJJHJKJDDJQJGGJAJQJJSJJJJZJJJJJPPPPPJJJJCJYJJGJJJJVJJJAJJAJHJUJJJJEEEJRJFFJJJJPPPJJWJBJJJJJJXJJJJYJLJJBJDJJJJVJEJFFFFFJJQJLJJNJJMJQJJYYJVJJKJJJHHJJEJJJSJJJJJJJJJJJJJJJYRMRRZRSRVVVVVVVVVDDVWVYVUVJJVQVUVKVLVVHHVVLVVAAVVWVDVVNVSVFVVVVHVNVVVVCVXXXVWVRVVVVVQV...

output:

41215
98045
13006
15385
181643
130328
6971
9714
12717
135813
164970
10514
67084
54684
5931
4119
21250
14437
7930
24602
64285
171517
19932
104818
35480
12387
55940
24200
64003
8490
10434
91309
12559
9367
11315
14214
47159
24946
38811
65328
46819
74067
60620
62612
445
45156
72503
39848
64885
10332
729...

result:


Test #4:

score: 0
Time Limit Exceeded

input:

1000 1000 1000
RRWRRZRRBRRRMRRRRRRRRQRRRRRYRRRRRRQRSRNNRURDRRRIRRRRSRFRRRRURRRRRKKRPPRMRGREERCRSRCRXXXRHRRRJRRRJRRTRNNRRRHRIRRRRWRRRRRRRBRRRRERRRRJRDDDRRRRRRPRRYRRQRRRRRROORRRGRURRRRKRRRRRRRRRRRRDRRRRRRRRRRFRBRNRRRBBRRNRRURRMRRNRRGRRRRRURRRFRRRRRRSSSRRYRGRRRGRURHRRYRRSRRRRURRURNRRRLRORQQRBBRRMRXRSSX...

output:

72696
20530
46499
40798
12058
109488
13521
82375
53595
84135
6260
45616
67445
34187
64419
42491
42951
79192
6925
19525
38752
144229
61230
14985
90122
34969
14577
11438
172374
26744
26982
32936
35236
66682
70647
29132
55886
15693
41597
24098
7793
48979
28233
47609
16907
58159
91435
72190
31184
78728
...

result:


Test #5:

score: 0
Time Limit Exceeded

input:

1000 1000 1000
BPPPPPPPPPPPPPSPPPQPPIPTPJPPPCPZPZPPPCPPQPPDPPZPXPPPPPPPOPHPBBBPPPPPVPPPPUUUPNPQPPAPPPPPPPSPIPPCPWPQPPPUUPDPNPHPPPGGPPPNNPPPPWPPPUPPPPUPPPPOPOPPPBPNPGPBPYPZPOPPPPPPJPPSPCCCPPQQPPPPPPPPPPPPFPNPPPEEPPPPPPPHPPTPPPNPPTTTPPPPPPZPPSPOOOPWPDPPPWPKPPZPGPHPPKPPPJPPJPOOPPAAPUPPOPPYPPTTPPPZPPSPP...

output:

96531
5337
34788
114265
64995
10289
28001
77386
17468
26652
1273
36676
63736
8717
47904
151107
127350
60438
131362
2606
17207
47321
3431
44642
5860
2274
21712
25076
31843
24831
8084
348
76173
39264
16906
3722
8551
19569
78501
17394
1904
14463
1285
27075
25399
4295
26677
128214
5227
176895
9490
48316...

result:


Test #6:

score: 0
Wrong Answer
time: 2ms
memory: 6488kb

input:

1000 1000 1000
OOTYEVJGBKKAGHFFHQRPELAEERXBQEEBBXDDCHTHHBBUGSSKVJJMKZAXSHRMBLLUYRIISQUQQFJJOXOKKUQSCHRUUGTRIVGPGYVUIYVYKHNRGJJSIZZXPLLSRSGQMJQQZYDDQQPZVVKKMSTLAOIIJEMWXTMTBYFYYBIDYOOPNXQQPFDDYZZAXXWTQBJJAKKTIIVDHBBPPQXXTTGSDOCDDUUCQQAAWTTDDBOOHJVVAANKFXJMCYYSZJJVIESXNNQQHHEYXXWCEDUCWTEDTLPUVICCHDDQR...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '302479', found: '1'

Test #7:

score: 0
Wrong Answer
time: 2ms
memory: 4448kb

input:

1000 1000 1000
IBVGGWZZWUFRZYCCGNNTTAJDDVMOETRYJGGAIAGVYLILTTCFFBBVKPPSFOTJTEULLTKKHGPPFFDNNWJGZJKJAASWQGKKZNZIDDWAABBUYWENFRCVVWWTTWFIILLGGLKKBZAAJJPPNRRQAQCKHKSACHHKWKKFYYJJWWBBCRRJJZPUUZZRYCXZVCTUTYYBVVLQTACCYYEVUUOOVXXNUUIRDDAOCCAAVVYYBVVKUGGWUCQBZTTEFFVMUUWAAPBBYYFOGPRWECLLFVZZBVGHDDSQFYYZZFQOI...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '543596', found: '1'

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 6692kb

input:

1000 1000 1000
HEMKGSSPNZYBEHHYIICGQZINEIOYUYZQROFTPJAVVAAVVXIISSBBYLAWYYOAAQLSPFIWYYHZZWQNGGEEOWWSHQQJADDBEEYFOBKOORRPEVGGECCMOFFBPPUSSERBBAOEELGIXAUKNNWAAPLLIRXTPXXGGHKIKYJVVGJTLWBQKKZOLWIIDGROSXBEMGGNBQDTDDQQCWYPVBXRPKHXXWQAAFZZNNZKKMJEPZYNJMWERKKRWSQQRNQXKIYCVFJGGZZGWWXTTIXQQKOLLNOIBBYFGGWOOYOYV...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '174777', found: '1'

Test #9:

score: 0
Wrong Answer
time: 2ms
memory: 6488kb

input:

1000 1000 1000
RRYDXXPWWEAEEAXPPPRRWGWSJJXXMBBBIIPMPMEKKVVVOZBBYYWEATTLMWHQQZUQQKHHHQZWWNNNOOWDWKVUCCAAAOISSYYHOOPCCAAHGGGZNOIIGTSUUUMMWZZMQXQJUFMURSSPPRBBCOLMMLXXXOOOHTSSPPYYDJJAAMMDAQJJJGGGEQQBBKLZZGGFZZZMMFJPPXXXZKLKLFCYYZTZZZIUKKKXAVAAVRNNSHAHHTHPXHZEZEOOGGYTRDIIIFIIHUBBBHSTNCCRIRHLLXMAOEBWBKIKV...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '52507', found: '1'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 6128kb

input:

1000 1000 1000
NNNKJYRPXSTJJKVVVZJJYYYGGHLHDWCCGGLJOOEEEUUAURRRFKKTTTUUUJJGGYUSSSTJWWREEWUMMGKQIIVVAZARLRAAEQQKXXSJJJQRUJJJOGNNAAQDDBEBBWWWRRGSRRBXXIISGGGHIIOOFFFSDQQQRHKKKPPTASSVKTDDEFAFJGJGOAOVVVXUUBKTRXXXBBAAKKYIILLYHHTTIRRMMWWOUBBYKKOOORAVVHHJJOHHXXPPXXMHXXROOERCKCMMOFYYYKKZLLNNNAAOOOEEZLKEETTHH...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '146826', found: '1'

Test #11:

score: 0
Wrong Answer
time: 2ms
memory: 6480kb

input:

1000 1000 1000
SSSNNUDHWWWMMJPFFCJSSGGZCHBHJJJLVRVOOPHHWWVXFFQQUSSPSSSHHJMMHQQACCMBBPPSCCXEZZAPPYQQQHHVVYBKBVVUOOJJJGGGZUHZMHHHTTZLZFFKKSWIITEEESWWJJBTKFFDIDBBDFFORRKWTMWEESSTYMYYYVVKKKHHJWEXJJWQASYHJDXGGMTTCCMLLVVVHIKICADAPDDDYYNNKDGGPVQMNCCCKNNEEWKSLFFFLLLREEIFLGGXUUCTTGYYWWWRRRIWWVYOJJOUPPQBBBUUY...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '5185', found: '1'

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 6652kb

input:

1000 1000 1000
DDDDDDDLLLLLLLLLLLLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 36th lines differ - expected: '2', found: '1'

Test #13:

score: 0
Wrong Answer
time: 0ms
memory: 6412kb

input:

1000 1000 1000
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 5th lines differ - expected: '2', found: '1'

Test #14:

score: 0
Wrong Answer
time: 2ms
memory: 6372kb

input:

1000 1000 1000
PPPPPPPPPPPPPPPPPSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 9th lines differ - expected: '2', found: '1'

Test #15:

score: 0
Wrong Answer
time: 0ms
memory: 6168kb

input:

1000 1000 1000
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 21st lines differ - expected: '2', found: '1'

Test #16:

score: 0
Wrong Answer
time: 1ms
memory: 4388kb

input:

994 992 1000
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 7th lines differ - expected: '2', found: '1'

Test #17:

score: 0
Wrong Answer
time: 0ms
memory: 6484kb

input:

980 995 1000
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 2nd lines differ - expected: '7', found: '1'

Test #18:

score: 0
Wrong Answer
time: 0ms
memory: 6184kb

input:

980 995 1000
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '2', found: '1'

Test #19:

score: 0
Wrong Answer
time: 2ms
memory: 6496kb

input:

994 990 1000
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 8th lines differ - expected: '2', found: '1'

Test #20:

score: 0
Wrong Answer
time: 0ms
memory: 6164kb

input:

984 992 1000
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 2nd lines differ - expected: '2', found: '1'