QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#704543#1874. Goldberg Machine 2carrotqqAC ✓519ms74068kbC++144.0kb2024-11-02 20:10:532024-11-02 20:10:53

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 5ms
memory: 22640kb

input:

3 3 9
>v>
vv>
v.>

v>>
v>>
v.>

2 3 1
2 2 1
2 1 1
1 3 3
1 2 2
2 3 3
2 3 1
1 1 2
1 2 1

output:

1
-1
-1
2
14
-1
-1
-1
-1
0

result:

ok 10 tokens

Test #2:

score: 0
Accepted
time: 99ms
memory: 21912kb

input:

1 1 100000
v

v

1 1 1
2 1 1
2 1 1
1 1 1
2 1 1
2 1 1
1 1 1
1 1 1
2 1 1
2 1 1
2 1 1
1 1 1
1 1 1
1 1 1
2 1 1
1 1 1
2 1 1
2 1 1
1 1 1
1 1 1
1 1 1
1 1 1
2 1 1
1 1 1
1 1 1
2 1 1
2 1 1
2 1 1
2 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
2 1 1
2 1 1
1 1 1
1 1 1
2 1 1
1 1 1
2 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
2...

output:

0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
...

result:

ok 100001 tokens

Test #3:

score: 0
Accepted
time: 99ms
memory: 21880kb

input:

2 2 100000
>v
v>

>>
>v

2 1 1
1 1 1
2 1 1
1 1 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
0
-1
-1
-1
2
-1
-1
-1
-1
-1
1
-1
1
-1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
-1
2
-1
-1
-1
2
-1
-1
-1
1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
-1
-1
2
-1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
2
-1
-1
-1
1
-1
-1
-1...

result:

ok 1001 tokens

Test #5:

score: 0
Accepted
time: 5ms
memory: 21960kb

input:

2 3 1000
vv>
v>v

>>v
v>v

1 2 1
1 2 2
1 2 3
1 1 2
2 1 2
1 2 2
1 1 2
2 1 2
2 2 2
1 1 2
2 1 2
1 1 1
1 1 2
2 1 2
1 2 2
1 1 2
2 1 2
2 2 2
1 1 2
2 1 2
2 1 1
1 1 2
2 1 2
1 2 2
1 1 2
2 1 2
2 2 2
1 1 2
2 1 2
1 2 1
1 1 2
2 1 2
1 2 2
1 1 2
2 1 2
2 2 2
1 1 2
2 1 2
1 1 1
1 1 2
2 1 2
1 2 2
1 1 2
2 1 2
2 2 2
1 1...

output:

7
-1
-1
-1
5
-1
-1
-1
-1
-1
3
-1
2
-1
-1
2
-1
-1
6
-1
-1
-1
-1
-1
-1
3
-1
-1
-1
-1
-1
-1
3
-1
-1
7
-1
-1
5
-1
-1
-1
-1
4
-1
-1
-1
-1
3
-1
-1
1
-1
-1
5
-1
-1
-1
-1
-1
-1
5
-1
-1
-1
-1
-1
-1
2
-1
-1
6
-1
-1
6
-1
5
-1
-1
-1
-1
-1
3
-1
-1
5
-1
-1
-1
-1
-1
3
-1
2
-1
-1
2
-1
-1
6
-1
-1
-1
-1
-1
-1
3
-1
-1...

result:

ok 1001 tokens

Test #6:

score: 0
Accepted
time: 105ms
memory: 21916kb

input:

1 10 100000
v>>>>>>v>>

>v>vvvvvvv

1 1 3
1 1 8
1 1 1
2 1 1
1 1 7
1 1 1
2 1 1
2 1 7
1 1 1
2 1 1
1 1 2
1 1 1
2 1 1
1 1 7
1 1 1
2 1 1
2 1 7
1 1 1
2 1 1
2 1 2
1 1 1
2 1 1
1 1 7
1 1 1
2 1 1
2 1 7
1 1 1
2 1 1
1 1 5
1 1 1
2 1 1
1 1 7
1 1 1
2 1 1
2 1 7
1 1 1
2 1 1
1 1 2
1 1 1
2 1 1
1 1 7
1 1 1
2 1 1
2 1 7
...

output:

135
139
11
10
9
73
74
75
139
138
137
139
140
141
77
76
75
11
12
13
15
14
13
77
78
79
143
142
141
157
158
159
95
94
93
29
30
31
29
28
27
91
92
93
157
156
155
153
154
155
91
90
89
25
26
27
43
42
41
105
106
107
171
170
169
171
172
173
109
108
107
43
44
45
47
46
45
109
110
111
175
174
173
429
430
431
36...

result:

ok 100001 tokens

Test #7:

score: 0
Accepted
time: 106ms
memory: 21912kb

input:

9 1 100000
>
>
v
>
v
>
v
>
v

>
v
>
v
v
>
>
>
v

1 1 1
1 5 1
1 6 1
1 8 1
1 9 1
1 2 1
2 2 1
1 3 1
1 2 1
2 2 1
2 3 1
1 2 1
2 2 1
1 4 1
1 2 1
2 2 1
1 3 1
1 2 1
2 2 1
2 3 1
1 2 1
2 2 1
2 4 1
1 2 1
2 2 1
1 3 1
1 2 1
2 2 1
2 3 1
1 2 1
2 2 1
1 9 1
1 2 1
2 2 1
1 3 1
1 2 1
2 2 1
2 3 1
1 2 1
2 2 1
1 4 1
1 2 1...

output:

58
59
43
75
203
53
51
49
53
55
57
61
59
57
49
51
53
49
47
45
41
43
45
37
35
33
37
39
41
45
43
41
215
213
211
215
217
219
223
221
219
211
213
215
211
209
207
203
205
207
199
197
195
199
201
203
207
205
203
53
51
49
53
55
57
61
59
57
49
51
53
49
47
45
41
43
45
37
35
33
37
39
41
45
43
41
25
27
29
25
23...

result:

ok 100001 tokens

Test #8:

score: 0
Accepted
time: 111ms
memory: 21888kb

input:

3 3 100000
>>>
vvv
>>v

>>>
vv>
>vv

1 1 1
1 1 2
1 1 3
1 2 1
1 2 2
1 3 1
1 3 3
1 3 1
2 3 1
1 2 2
1 3 1
2 3 1
2 2 2
1 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
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #10:

score: 0
Accepted
time: 210ms
memory: 22196kb

input:

1 100 100000
v>vv>>vvv>>>>v>>>vvv>>>>v>>>vv>>vv>v>v>vv>vv>vvv>>>>vv>v>vvv>v>vv>>>vv>>>v>>v>>v>>vv>v>>>vvvv>>v>vv>

vvvv>>v>v>v>>v>vv>v>vv>v>>>>>v>v>>v>>>>>>>>v>vv>v>vv>>>vvv>vv>>>>v>vvvvvvv>v>v>v>>>>>>vv>v>>>>v>>>>v

1 1 8
2 1 62
2 1 53
2 1 91
2 1 25
2 1 65
2 1 71
1 1 54
2 1 59
2 1 98
1 1 56
1 1 89
...

output:

130162746902623059640821711746
130162746902623059640821711874
130162746904928902650035405826
130162746904933406249662776322
131400686944218786524561900546
131400686944218786524578677762
131400686962665530598288229378
131400685782073909880876925954
131400685782082917080131666946
131400685782371147456...

result:

ok 100001 tokens

Test #11:

score: 0
Accepted
time: 208ms
memory: 22904kb

input:

100 1 100000
>
v
>
v
v
>
v
>
>
v
v
>
v
v
>
>
>
v
>
>
v
>
>
>
v
v
v
>
>
>
v
v
>
v
>
>
>
v
v
v
v
>
>
>
v
v
>
>
>
v
v
v
v
v
v
v
>
>
>
v
>
>
>
>
>
v
>
>
v
>
v
>
>
>
v
>
v
v
v
v
v
v
>
>
>
>
>
v
>
>
v
v
v
v
>
v
>
v
>
v

v
>
v
v
v
>
>
>
>
>
v
v
>
v
v
>
>
v
v
>
>
v
v
v
>
>
v
>
v
>
v
v
v
>
>
v
v
>
>
v
v
>
v
...

output:

373624807217797461802635479613
373624806922649556623282653757
374243776942292246760732215869
576494173228879804361795188163
576532858855107472495385785795
576532858855107507679757874627
576532858855107507679757874755
576532858855107507679757940291
576532858855107507679755843139
576532858855107507679...

result:

ok 100001 tokens

Test #12:

score: 0
Accepted
time: 495ms
memory: 73224kb

input:

100 100 100000
vvvvv>vv>vv>>>v>>vv>vv>v>>v>>>v>v>v>>vvvvvv>v>>v>>>>>vv>>>v>v>>vvv>>vvvvvvvvvv>v>v>v>>v>vvv>>>vv>>vv
>>>v>vvv>>>vvvvvv>v>>>vv>>vvvv>>>>>>vv>>vv>>>>>v>>vv>>>vvv>>vvvv>>>v>>vv>v>v>>v>v>>vv>>v>>v>>>vv>v>v
vvv>>>v>v>>vv>vv>>>v>>>vv>vvvv>v>>>v>v>v>>>>vvv>>vvv>vvvvv>>>v>>>v>v>>vvvv>>vvvv>>v...

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
...

result:

ok 100001 tokens

Test #13:

score: 0
Accepted
time: 474ms
memory: 64212kb

input:

100 100 100000
>>v>v>vvv>v>vv>>v>>v>>v>vvv>vv>v>>>>>>>vv>vv>>>>vvvv>>>v>>v>v>>>....................................
v>>>>v>.>vvvv>v>>>>vvvv>>vvv>>v>.vv>>>>.>>vvvvvv>v>v>v>vv>v>vv>v>...................................
>>vv>>v>vvvv>>>>>vv>>vvv>v>v.>>>vv>vvvv>>>.vvv>v.>>>vvvvv>vvvv>>v>>vvv>vvvv>v>vv>vv...

output:

253528151914256935978069277722645579058348007113389173875510
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #14:

score: 0
Accepted
time: 519ms
memory: 74068kb

input:

100 100 100000
vvv>>v>>vvv>v>>vv>>>vv>>>>v>>vv>>>>vvvv>v>v>>v>vvvvv>vv>vvv>>v>vv>vvv>>>>>vvvv>vvvvv>v>v>>v>v>>>>>v>
>vv>v>vvv>v>>>vv>>v>>v>v>>vvvvvvvv>>>vv>>vv>vv>v>v>>>v>v>v>vv>>>>>v>>v>v>>v>v>v>>>>>v>>vv>>>v>vv>>>v
v>v>v>v>>>v>>v>>>>>>>v>vv>vv>>>>v>>v>>vvv>v>v>>>vv>vvv>vv>vv>v>vvvv>vv>>>>vv>>>vvvv...

output:

23386290453762822566412058133305892764924256716359048750097
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #15:

score: 0
Accepted
time: 442ms
memory: 58852kb

input:

100 100 100000
vv>v>...............................................................................................
>vvvvv>vvv>>v>vvv>vv>>v.............................................................................
>vvv>>vv>.v>vv.vvv>v>v>v>>>...........................................................

output:

42658660090357251640628465467726161658558031734734431452118
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #16:

score: 0
Accepted
time: 287ms
memory: 35356kb

input:

100 100 100000
>>>v................................................................................................
v.v.................................................................................................
v.>v..................................................................................

output:

43815677202469463796265627043100870828664328138117793224362
-1
43815677202469463796265627043100870828664328138117793224361
-1
43815677202469463796265627043100870828664328138117793224360
-1
-1
-1
43815677202469463796265627043100870828664328138117793224359
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100001 tokens

Test #17:

score: 0
Accepted
time: 182ms
memory: 29228kb

input:

100 100 100000
vvvv................................................................................................
v...................................................................................................
v.....................................................................................

output:

222453068264192526417000218257812802177233353809948814995323
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #18:

score: 0
Accepted
time: 379ms
memory: 47628kb

input:

100 100 100000
>v>>v...............................................................................................
>vvv>>..............................................................................................
>>vv.v>>>.............................................................................

output:

201750991551104042432020447813933605717073792565088416920
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #19:

score: 0
Accepted
time: 405ms
memory: 49620kb

input:

100 100 100000
v>v>>vvv............................................................................................
>v.>.>>v>vvv>>>.....................................................................................
......>vv.>v>>v.......................................................................

output:

39016689483511987693168985971494459264198641421031014240019
-1
39016689483511987693168985971494459264198641421031014240019
-1
39016689483511987693168985971494459264198641421031014240019
-1
39016689483511987693168985971494459264198641421031014240019
-1
390166894835119876931689859714944592641986414210...

result:

ok 100001 tokens

Test #20:

score: 0
Accepted
time: 381ms
memory: 56620kb

input:

100 100 100000
>...................................................................................................
>v>>>v>.............................................................................................
v>vvvv>>..............................................................................

output:

124624611308017348521697627034445754534951315753056709418940
124624611308017348521697627034445754534951315753056709418939
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
124624611308017348521697627034445754534951315753056709418938
124624611308017348521697627034445754534951315753056709418939
-1
-1
-1
-1...

result:

ok 100001 tokens

Test #21:

score: 0
Accepted
time: 272ms
memory: 72788kb

input:

100 100 100000
vv>v>v>>v>>v>v>vvv>>>vv>vvvvvv>v>>>>v>>v............................................................
vvv>>>vv>vv>>>>>vvv>>vv>v>>>v>vv>>>>vvv>>vv>v>v>vvv>>vvv>v>v>>>v>v>v>v>>>>v>>vvv>>vvv>vv>>v>vv>vvvv>
>>>>>v>>>vvv>v>>vv>vv>>>>>vvvvv>vv>v>v>v>>>>>vvv>>vvvv.>>v>>vvv>>v>vvvvvvvvv>v>v>v>...

output:

107671931810604867317823529653294578411322501736483480318371
93195323721768917124921731889350746903952872486365624094301
107671931810604867317823529653294578411322501736483480318371
294062579254142701567666993431996072219228246709214728506973
107671931810604867317823529653294578411322501736483480318...

result:

ok 100001 tokens

Test #22:

score: 0
Accepted
time: 268ms
memory: 73124kb

input:

100 100 100000
>vvv>>vv>>>>>>vvv>v>>>>vv>vvvv>>>v>v>vv>>>vv>>v>>>>>>>>vvvvv>>vv>>v>>>v>vv>v>>v>vv>vvvvvv>>>>vvv>vvv
vvvv>vvv>v>>>>vv>vvv>>vv>>>v>>vvv>>>v>>v>>v>>>>v>>>>>vv>>vvv>vvvvv>v>>>>>vv>>>>v>>vvv>>>v>vvvv>v>vv>
v>>v>v>>>v>>>>>vvvvv>v>>vvv>>v>vv>v>vv>vv>v>>vvv>>>vvvvv>>>>>>vvv>v>>>vv>vvvv>>>vv>...

output:

17082601553275761539905298915831996601457557630861824921682
-1
17082601553275761539905298915831996601457557630861824921682
-1
17082601553275761539905298915831996601457557630861824921682
-1
17082601553275761539905298915831996601457557630861824921682
-1
170826015532757615399052989158319966014575576308...

result:

ok 100001 tokens

Test #23:

score: 0
Accepted
time: 437ms
memory: 57644kb

input:

100 100 100000
v>vv>>>vvvv>>>v>>vv>v>vvvvvvvv>vvvv>v>vv>v>>vv>v>v>>>vvv>vv>>>vvv>v>vvv>v>v>vv>>>vv>vvvvv>v>vv>vv>>v
>.>.>.>.>.v.v.>.v.v.>.v.v.v.>.v.>.v.>.v.v.>.v.>.>.v.>.>.>.>.>.>.>.>.>.v.v.v.>.v.v.>.v.v.v.v.>.v.v.v.
vvvv>vv>v>>vv>v>vvv>>>vvvv>>>v>v>v>vvvv>v>>v>vvv>>>v>>v>>>>v>>v>>>v>v>v>vvv>>>v>>v>...

output:

18784946845871147976358177942986863608005443350565495986568
-1
18784946845871147976358177942986863608005443350565495986567
-1
18784946845871147976358177942986863608005443350565495986567
-1
18784946845871147976358177942986863608005443350565495986567
-1
187849468458711479763581779429868636080054433505...

result:

ok 100001 tokens

Test #24:

score: 0
Accepted
time: 430ms
memory: 52224kb

input:

100 100 100000
>>>>>>>>>>>>>>>>>>>>>>>v>>>>>>>>>>>>>>>>>v>>>>>>>>v>v>>>>>>>>>>>v>>>>>>>>>>>>>>>>>>>>>>>>v>>>>>>>>>>
>>.>>.>>.>>.>>.>v.>>.>>.>>.>>.>>.>>.vv.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>>.>
>..>..>..>..>..>..>..>..>..>..>..>..>..>..>..>..>..>..>..v..>..>..v..>..>..>..>..>....

output:

53381669762158452489209327555144242907672197839891108814646
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #25:

score: 0
Accepted
time: 327ms
memory: 52244kb

input:

100 100 100000
>>>>>>>v>>>>vv>>>>>v>>>v>>>>v>v>>v>>>>>>>>>>>>>v>>>v>v>>>>>v>>>v>>>>>>>>>>vvv>v>>>>>>v>v>>vv>>v>v>v>
>>.>v.>v.>v.>>.>>.>>.>v.>v.>>.>>.v>.v>.>>.v>.>v.v>.v>.>>.>v.>v.>v.>>.>>.>>.>>.>v.v>.>>.>v.>>.v>.v>.>
v..>..v..>..v..>..>..>..v..v..>..>..>..>..>..>..v..v..>..v..>..>..>..>..>..>..>..v....

output:

57275352746220220487283409946985056949752315135185187188423
-1
57275352746220220487283409946985056949752315135185187188423
-1
57275352746220220487283409946985056949752315135185187188423
-1
57275352746220220487283409946985056949752315135185187188423
-1
572753527462202204872834099469850569497523151351...

result:

ok 100001 tokens

Test #26:

score: 0
Accepted
time: 364ms
memory: 52644kb

input:

100 100 100000
vv>vv>v>>>>>>>>>>>v>vv>v>>>>>v>vvv>>>>>>vv>>>>>vv>v>>v>>>>>v>>>v>>>vv>v>v>vvv>>>vv>>>>v>>v>>>v>>>vv>
>>.>>.vv.>>.>v.vv.v>.>>.v>.v>.v>.vv.>v.>>.vv.>v.vv.>>.vv.>>.vv.>>.>v.v>.>>.>v.v>.v>.>v.vv.>v.>v.v>.v
>..>..v..>..>..>..>..v..v..>..>..>..>..v..>..>..>..>..>..>..>..v..v..>..>..v..>..v....

output:

64907501743444547022137361805387261917105074916262651128947
-1
64907501743444547022137361805387261917105074916262651128947
-1
64907501743444547022137361805387261917105074916262651128947
-1
64907501743444547022137361805387261917105074916262651128947
-1
649075017434445470221373618053872619171050749162...

result:

ok 100001 tokens

Test #27:

score: 0
Accepted
time: 351ms
memory: 52064kb

input:

100 100 100000
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv>vvvvv>vvvvvvvvvvvvvvvvv>vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.vv.>v.vv.vv.vv.vv.v
v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v..v....

output:

21976302509188623113582373479770928527855534478211028789917
-1
21976302509188623113582373479770928527855534478211028789917
-1
21976302509188623113582373479770928527855534478211028789917
-1
21976302509188623113582373479770928527855534478211028789917
-1
219763025091886231135823734797709285278555344782...

result:

ok 100001 tokens

Test #28:

score: 0
Accepted
time: 281ms
memory: 30324kb

input:

100 100 100000
>>..................................................................................................
>>..................................................................................................
>>v>>.................................................................................

output:

4899093492166070486573268177568463493559612269189682940140
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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:

ok 100001 tokens

Test #29:

score: 0
Accepted
time: 356ms
memory: 33644kb

input:

100 100 100000
vv>vvvv.............................................................................................
v>vvv.v.............................................................................................
vvv>>vvvv.............................................................................

output:

5852208803576017905737030078378565171209408740723222843758
-1
5852208803576017905737030078378565171209408740723222843758
-1
5852208803576017905737030078378565171209408740723222843758
-1
5852208803576017905737030078378565171209408740723222843758
-1
5852208803576017905737030078378565171209408740723222...

result:

ok 100001 tokens

Test #30:

score: 0
Accepted
time: 343ms
memory: 38772kb

input:

100 100 100000
>>>.................................................................................................
>>>>>v..............................................................................................
>>>>v>>>..............................................................................

output:

229725942343818046032259298037952089749446429318663445046838
-1
-1
229725942343818046032259298037952089749446429318663445046839
-1
-1
-1
-1
-1
-1
-1
-1
-1
229725942343818046032259298037952089749446429318663445046840
-1
-1
-1
-1
-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:

ok 100001 tokens