QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504362#4374. What Really Happened on Mars?xiaowuc1AC ✓236ms75648kbJava84.5kb2024-08-04 12:38:432024-08-04 12:38:43

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 42ms
memory: 38820kb

input:

3 1
50 2 5 C1 L1 C1 U1 C1
1 1 5 C1 L1 C100 U1 C1
70 3 1 C1

output:

106
107
71

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 39ms
memory: 38192kb

input:

3 3
5 3 5 C1 L1 C1 U1 C1
3 2 9 C1 L2 C1 L3 C1 U3 C1 U2 C1
1 1 9 C1 L3 C3 L2 C1 U2 C1 U3 C1

output:

8
15
16

result:

ok 3 lines

Test #3:

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

input:

19 8
7 7 23 L8 C5 C1 C1 L1 U1 L5 L3 U3 U5 U8 C1 C4 L3 L1 C2 U1 U3 L3 C2 C4 U3 C2
19 14 6 L7 L3 L4 U4 U3 U7
6 5 3 L1 U1 C5
35 2 18 L2 L5 L7 U7 C3 C3 C3 U5 U2 L4 L1 C2 C2 C5 U1 U4 L3 U3
45 6 3 C3 L6 U6
32 3 10 C4 C1 C3 L1 L6 L8 C2 U8 U6 U1
17 17 50 L4 L6 C4 L8 U8 U6 U4 L1 L5 L2 L8 L4 L3 L7 L6 U6 U7 U3...

output:

329
136
337
379
332
361
106
307
1
251
285
209
419
59
136
201
351
114
57

result:

ok 19 lines

Test #4:

score: 0
Accepted
time: 47ms
memory: 39708kb

input:

15 6
35 14 45 L2 L6 L3 L5 L1 L4 C2 C5 C1 C1 C4 C5 C4 C1 C4 C4 C1 C1 C3 C4 C4 C2 C2 C5 C2 C5 C3 C5 C2 C2 C5 C5 C2 C4 U4 U1 U5 U3 U6 L6 C3 L3 U3 U6 U2
3 7 17 L4 U4 L6 L3 L1 C2 U1 C5 U3 U6 L3 L4 L5 U5 C2 U4 U3
32 13 19 L1 L3 L5 C5 U5 U3 L2 L4 C2 U4 U2 L3 C5 C4 L5 U5 C4 U3 U1
18 4 44 L2 L5 L4 L3 L6 L1 C...

output:

130
12
150
382
127
289
247
253
218
175
414
218
197
417
487

result:

ok 15 lines

Test #5:

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

input:

20 1
42 1 34 C1 L1 C5 C3 C5 C1 C3 U1 L1 C4 C2 C2 C3 C1 C1 C1 U1 C3 C3 C3 L1 C4 C5 C2 U1 C1 C1 L1 C2 C5 U1 C2 C3 C4
5 11 20 C3 L1 U1 L1 C1 C5 C4 C2 C4 C1 C3 C1 C4 C4 C2 C3 C4 C5 C3 U1
40 6 21 L1 C5 C3 C5 C1 C2 C3 C2 C5 C4 C4 C2 C4 C4 C5 C3 C4 C3 C1 C1 U1
45 16 43 L1 C2 C3 C2 C5 C3 C4 C2 C1 C1 C2 C1 C...

output:

1757
923
1361
547
747
444
172
554
1257
1300
1023
1582
1157
423
1471
874
320
129
653
1687

result:

ok 20 lines

Test #6:

score: 0
Accepted
time: 44ms
memory: 37968kb

input:

20 3
37 18 29 L2 C1 L3 L1 C4 C5 C4 C2 U1 U3 U2 C4 C2 L1 L3 L2 C1 C1 C2 C3 C5 C3 C3 C3 C4 C4 U2 U3 U1
3 1 32 L1 L2 L3 C1 C2 C5 C3 C4 C3 C4 C5 C4 C4 C1 C1 C3 C1 C2 U3 L3 C5 C3 C5 C2 C4 C2 C3 C5 U3 U2 U1 C5
34 13 14 C1 L2 L3 C3 C1 C4 C4 C2 L1 C1 C3 U1 U3 U2
42 9 43 L2 L1 L3 C4 C4 U3 L3 C2 C2 C4 C3 C4 U...

output:

156
991
461
698
490
703
105
98
610
922
383
986
558
442
781
362
243
765
786
885

result:

ok 20 lines

Test #7:

score: 0
Accepted
time: 55ms
memory: 38072kb

input:

19 8
29 10 9 L6 L5 L8 L3 C4 U3 U8 U5 U6
30 9 14 L2 L5 L7 L1 C5 C3 U1 C3 U7 C1 C4 C2 U5 U2
20 7 44 L6 C4 L2 U2 U6 L4 C5 U4 L1 U1 L3 L4 C5 C2 U4 C5 L7 L1 L6 L2 C4 U2 U6 U1 U7 L8 U8 L8 U8 L6 C3 U6 C2 C2 L2 C3 U2 C1 L1 U1 C1 U3 L5 U5
46 12 39 L2 L5 L1 L4 L7 C3 U7 U4 U1 L8 C5 C1 U8 L1 C5 C2 C5 L3 L4 C3 L...

output:

190
208
284
186
58
359
344
71
39
63
387
147
247
71
9
115
39
307
298

result:

ok 19 lines

Test #8:

score: 0
Accepted
time: 32ms
memory: 38180kb

input:

18 5
36 8 23 L5 L1 L4 L2 L3 C3 C5 U3 U2 L2 C4 L3 U3 C5 L3 U3 U2 L2 C2 U2 U4 U1 U5
44 5 30 L2 C3 C1 L4 U4 C4 C5 U2 L4 U4 C5 L5 C3 L1 U1 C5 C4 C5 L1 U1 U5 L1 L5 C3 U5 U1 C2 L4 U4 C5
38 15 44 L2 C5 C3 U2 C1 L5 C4 U5 C2 C2 L2 C5 C4 C4 L1 L5 L3 C5 U3 C4 C5 L3 U3 L4 U4 L4 U4 C3 U5 U1 L1 L5 C1 C1 C4 U5 L3 ...

output:

266
400
146
154
469
236
404
35
28
355
446
287
214
174
78
196
80
247

result:

ok 18 lines

Test #9:

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

input:

13 4
3 8 3 L2 C5 U2
39 9 29 L3 C5 C2 U3 L3 L2 U2 U3 C5 C4 C1 L2 L3 C5 L1 C5 L4 C4 U4 U1 U3 U2 L1 C3 C5 U1 C3 C5 C4
17 11 32 C4 L4 U4 L2 L3 L1 L4 U4 U1 U3 U2 L1 L4 U4 U1 L1 L4 U4 L2 U2 C5 C3 C1 L4 U4 L3 C1 C3 U3 U1 C4 C5
27 2 18 L2 L4 C3 C2 C2 L1 C5 U1 U4 U2 L3 L4 L2 L1 U1 U2 U4 U3
12 13 16 L1 L2 U2 ...

output:

8
125
43
479
17
518
365
302
74
201
467
163
1

result:

ok 13 lines

Test #10:

score: 0
Accepted
time: 50ms
memory: 36984kb

input:

18 10
18 7 8 L10 L7 L5 U5 U7 U10 L1 U1
18 12 48 L3 L9 U9 U3 C3 L8 L1 L5 C5 C5 U5 U1 U8 C1 C2 L2 C3 C3 L7 C1 C2 U7 U2 L4 L6 U6 L2 L6 L5 L7 L9 L3 C5 U3 U9 U7 U5 U6 U2 U4 L3 L2 L4 L10 U10 U4 U2 U3
26 14 15 L8 U8 L10 C2 C2 C2 U10 L6 L4 C3 L7 C2 U7 U4 U6
41 9 4 L1 C3 C5 U1
28 11 33 L5 L9 C2 U9 U5 C1 C5 C...

output:

353
227
171
308
263
412
50
400
353
300
381
166
113
23
77
200
455
412

result:

ok 18 lines

Test #11:

score: 0
Accepted
time: 81ms
memory: 42476kb

input:

19 11
9319 4 15 L1 C84 U1 L11 L4 U4 L1 C36 L7 C53 U7 U1 C45 C39 U11
1644 15 60 L7 L2 C11 U2 L8 C99 C26 L5 L9 L4 L1 C81 L11 U11 C25 U1 U4 U9 U5 L1 U1 C77 L4 L10 L9 U9 L6 L3 L1 L5 U5 L5 L9 U9 U5 U1 U3 U6 L6 U6 U10 U4 L5 L2 L9 L3 C67 C6 L6 U6 U3 C57 U9 C11 C100 C20 U2 U5 U8 U7
100 11 64 L4 L10 C30 U10 ...

output:

9684
2454
3710
5812
9379
6931
1232
12276
9842
3012
5690
8840
8261
9412
9958
4834
10937
5620
9427

result:

ok 19 lines

Test #12:

score: 0
Accepted
time: 96ms
memory: 44660kb

input:

19 5
3387 10 37 L4 L5 L3 C11 C84 L2 C2 C75 C13 L1 C96 C1 C28 C30 C82 C51 C35 C62 C22 U1 U2 L1 L2 U2 U1 U3 U5 C44 C43 C55 C71 L5 L3 U3 C10 U5 U4
4320 14 37 L5 L4 L1 C38 U1 L1 L3 C90 U3 C18 U1 U4 U5 L1 L2 C99 U2 L2 U2 C76 U1 L3 L4 L5 L1 U1 U5 U4 U3 L4 L5 L2 L1 U1 U2 U5 U4
2558 19 5 L4 L3 C59 U3 U4
413...

output:

14224
11881
3986
5720
13409
12556
14819
11881
24130
22568
21141
23230
20084
17860
510
23230
3986
14272
8498

result:

ok 19 lines

Test #13:

score: 0
Accepted
time: 58ms
memory: 42740kb

input:

4 4
3385 4 75 L2 L4 L1 L3 C19 C95 C84 C12 C51 C5 C27 C43 C61 C38 C29 C73 C70 C56 C56 C38 C19 C99 C81 C46 C43 C9 C99 C19 C59 C22 C42 C78 C3 C71 C68 C44 C28 C84 C59 C60 C55 C54 C81 C70 C63 C13 C68 C10 C32 C86 C40 C44 C73 C42 C35 C41 C95 C25 C54 C89 C90 C59 C96 C82 C3 C62 C93 C3 C57 C50 C8 U3 U1 U4 U2
...

output:

6848
8922
13697
10561

result:

ok 4 lines

Test #14:

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

input:

1 1
7 1 5 C3 L1 C4 U1 C1

output:

15

result:

ok single line: '15'

Test #15:

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

input:

1 1
4 1 99 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 C1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U...

output:

5

result:

ok single line: '5'

Test #16:

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

input:

1 1
41 1 2 L1 U1

output:

41

result:

ok single line: '41'

Test #17:

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

input:

1 3
2 1 29 C3 L2 L1 U1 U2 C3 L2 L1 C3 U1 L1 U1 U2 C3 L2 C3 L1 C3 U1 C3 L1 C3 U1 C3 L1 C3 U1 C3 U2

output:

35

result:

ok single line: '35'

Test #18:

score: 0
Accepted
time: 31ms
memory: 40468kb

input:

1 10
8 1 34 C1 L10 C1 L9 C1 L8 C1 L7 C1 L6 C1 L5 C1 L4 L3 L2 L1 C2 U1 C4 U2 C10 U3 C9 U4 U5 U6 U7 C6 U8 C5 U9 U10 C2

output:

53

result:

ok single line: '53'

Test #19:

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

input:

1 10
6 1 88 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 C17 C18 C19 C20 C21 C22 C23 C24 C25 C26 C27 C28 C29 C30 C31 C32 C33 C34 C35 C36 C37 C38 C39 C40 C41 C42 C43 C44 C45 C46 C47 C48 C49 C50 C51 C52 C53 C54 C55 C56 C57 C58 C59 C60 C61 C62 C63 C64 C65 C66 C67 C68 C69 C70 C71 C72 C73 C74 C...

output:

3922

result:

ok single line: '3922'

Test #20:

score: 0
Accepted
time: 30ms
memory: 36884kb

input:

2 1
3 2 7 C4 L1 C2 U1 L1 C2 U1
3 1 7 C4 L1 C1 U1 L1 C1 U1

output:

11
17

result:

ok 2 lines

Test #21:

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

input:

2 2
3 2 8 C4 L1 C2 U1 C3 L2 C2 U2
3 1 8 C4 L2 C2 U2 C3 L1 C2 U1

output:

14
25

result:

ok 2 lines

Test #22:

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

input:

2 2
8 2 8 L2 C2 U2 C3 L1 C2 U1 C1
3 1 8 C4 L2 C9 U2 C3 L1 C2 U1

output:

24
29

result:

ok 2 lines

Test #23:

score: 0
Accepted
time: 22ms
memory: 39596kb

input:

2 2
8 2 7 L1 C2 L2 C5 U2 C1 U1
3 1 8 C1 L2 C9 L1 C3 U1 C4 U2

output:

28
20

result:

ok 2 lines

Test #24:

score: 0
Accepted
time: 44ms
memory: 38052kb

input:

3 4
99 3 3 L2 C1 U2
8 2 7 L3 C2 L4 C5 U4 C1 U3
3 1 8 C1 L2 C9 L1 C3 U1 C4 U2

output:

100
28
20

result:

ok 3 lines

Test #25:

score: 0
Accepted
time: 40ms
memory: 38384kb

input:

4 4
50 4 2 L1 U1
4 3 3 L3 C1 U3
6 2 1 C9
1 1 7 L1 C1 L2 C9 U2 C9 U1

output:

50
21
30
20

result:

ok 4 lines

Test #26:

score: 0
Accepted
time: 32ms
memory: 37212kb

input:

10 1
3 3 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 1 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 4 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 5 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 9 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 2 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 6 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 8 9 C4 L1 C2 U1 C5 L1 C1 U1 C3
3 7 9 C4 L1 C2 U1 C5 L1 C1 U1 C...

output:

123
153
108
93
33
138
78
48
63
18

result:

ok 10 lines

Test #27:

score: 0
Accepted
time: 44ms
memory: 38536kb

input:

10 10
45 10 7 L10 C1 L1 C1 U1 C1 U10
40 9 7 L9 C1 L1 C1 U1 C1 U9
35 8 7 L8 C1 L1 C1 U1 C1 U8
30 7 7 L7 C1 L1 C1 U1 C1 U7
25 6 7 L6 C1 L1 C1 U1 C1 U6
20 5 7 L5 C1 L1 C1 U1 C1 U5
15 4 7 L4 C1 L1 C1 U1 C1 U4
10 3 7 L3 C1 L1 C1 U1 C1 U3
5 2 7 L2 C1 L1 C1 U1 C1 U2
1 1 40 C1 L1 C99 L2 C1 U2 C1 L3 C1 U3 C1...

output:

122
125
128
131
134
137
140
143
146
119

result:

ok 10 lines

Test #28:

score: 0
Accepted
time: 43ms
memory: 39836kb

input:

10 10
45 10 7 L10 C7 L1 C7 U1 C1 U10
40 9 7 L9 C7 L10 C7 U10 C1 U9
35 8 7 L8 C7 L9 C7 U9 C1 U8
30 7 7 L7 C7 L8 C7 U8 C1 U7
25 6 7 L6 C7 L7 C7 U7 C1 U6
20 5 7 L5 C7 L6 C7 U6 C1 U5
15 4 7 L4 C7 L5 C7 U5 C1 U4
10 3 7 L3 C7 L4 C7 U4 C1 U3
5 2 7 L2 C7 L3 C7 U3 C1 U2
1 1 8 C1 L1 C99 L2 C1 U2 C1 U1

output:

118
133
148
163
178
193
208
223
238
103

result:

ok 10 lines

Test #29:

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

input:

10 10
900 10 1 C1
800 9 1 C1
700 8 1 C1
600 7 1 C1
500 6 1 C1
400 5 1 C1
300 4 1 C1
200 3 1 C1
100 2 1 C1
1 1 1 C1

output:

901
801
701
601
501
401
301
201
101
2

result:

ok 10 lines

Test #30:

score: 0
Accepted
time: 48ms
memory: 39860kb

input:

10 10
90 10 1 C100
80 9 1 C100
70 8 1 C100
60 7 1 C100
50 6 1 C100
40 5 1 C100
30 4 1 C100
20 3 1 C100
10 2 1 C100
1 1 1 C100

output:

190
280
370
460
550
640
730
820
910
1001

result:

ok 10 lines

Test #31:

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

input:

17 5
2 10 45 C3 C2 C2 C4 L5 C3 C3 C4 L4 C2 U4 C5 C1 U5 L3 C3 C4 U3 L3 C1 C5 C1 U3 L5 U5 C1 C1 C5 L1 L3 L5 L2 C4 U2 U5 U3 U1 L3 L4 L2 U2 L5 U5 U4 U3
24 15 15 L3 L4 U4 L2 C1 U2 L4 L5 U5 C5 C1 L2 U2 U4 U3
34 8 14 L5 L2 L4 L1 L3 C4 C1 C3 U3 C5 U1 U4 U2 U5
43 9 19 L3 C3 L5 C1 L1 U1 L4 U4 C5 C4 C2 C2 C5 C...

output:

266
93
304
291
131
395
536
93
206
147
359
400
477
217
455
47
312

result:

ok 17 lines

Test #32:

score: 0
Accepted
time: 48ms
memory: 40400kb

input:

17 5
44 7 46 L4 L1 L2 L5 C1 L3 U3 U5 L5 U5 C4 C5 C2 L5 L3 C3 C3 C5 U3 U5 U2 L3 U3 C5 L5 L3 L2 C5 C5 C4 C4 C4 C1 C1 U2 U3 L2 U2 L2 U2 C3 L3 U3 U5 U1 U4
41 8 40 L4 L1 L5 L3 C3 C5 C2 L2 U2 C3 L2 C1 C3 C4 U2 U3 U5 L3 L2 L5 C3 C1 C1 U5 U2 U3 U1 U4 L4 L5 C5 L2 C5 C3 C1 U2 U5 C1 C4 U4
16 17 7 L1 L5 U5 C3 C...

output:

447
392
24
266
42
518
50
347
608
127
461
177
293
122
621
578
112

result:

ok 17 lines

Test #33:

score: 0
Accepted
time: 47ms
memory: 37192kb

input:

7 9
13 3 25 L9 C1 C4 U9 L6 L2 C2 U2 L1 C1 U1 L9 L3 C3 U3 U9 L8 L4 U4 U8 U6 L3 C3 C5 U3
22 4 10 C4 L8 L2 L7 C5 U7 C1 C3 U2 U8
14 1 20 L7 C2 C5 U7 L2 C2 C5 U2 L8 C3 U8 L2 L9 L3 U3 L5 U5 C2 U9 U2
31 6 5 C3 C2 C3 L5 U5
19 5 37 L1 U1 C2 L4 U4 C2 L5 L1 L9 C3 C1 C5 C1 L7 U7 U9 U1 U5 C1 C2 L1 L4 U4 U1 L9 C3...

output:

97
85
149
48
71
130
40

result:

ok 7 lines

Test #34:

score: 0
Accepted
time: 47ms
memory: 37208kb

input:

10 10
19 6 42 L9 L5 L1 L2 L6 L7 L3 L4 L8 C1 U8 U4 U3 U7 C4 L8 C3 C5 U8 L8 C1 C4 C1 C1 C1 U8 U6 U2 U1 U5 L5 C2 C3 C2 L4 C5 L3 U3 C3 U4 U5 U9
48 1 29 L2 L7 C5 U7 C1 L9 L8 L6 L10 L1 C3 C5 C1 U1 L7 U7 C5 C1 U10 U6 U8 U9 C1 C5 C1 L9 C4 U9 U2
47 10 35 C3 C2 L1 L7 L3 L10 C2 U10 U3 C2 U7 L8 C1 C3 U8 L3 U3 C...

output:

101
251
86
62
219
183
195
202
142
183

result:

ok 10 lines

Test #35:

score: 0
Accepted
time: 56ms
memory: 38996kb

input:

20 8
25 3 43 L2 L1 L7 L5 L6 L8 U8 C3 C3 C1 C4 C4 L4 L3 U3 C2 L3 L8 C3 C5 C3 C2 C3 U8 U3 U4 U6 U5 U7 U1 L4 U4 L4 C4 C4 U4 C3 C2 C1 C3 C4 C5 U2
39 10 7 L5 L3 C4 C5 C1 U3 U5
28 9 11 L6 L3 L1 C3 U1 U3 L1 C5 C3 U1 U6
15 19 32 L6 L7 C4 L3 C1 C5 C4 U3 C3 C4 C1 C1 C5 C2 C4 C5 L4 C4 U4 U7 U6 L8 L6 C3 C1 C1 L...

output:

514
303
314
85
221
77
421
579
455
336
594
264
194
267
144
293
365
5
348
144

result:

ok 20 lines

Test #36:

score: 0
Accepted
time: 39ms
memory: 37788kb

input:

10 6
48 3 20 L5 L4 C5 U4 U5 L1 L3 U3 U1 C2 L4 U4 L6 L5 U5 U6 L6 C1 C5 U6
22 2 26 L2 L6 L3 L4 C3 U4 U3 L3 L1 C5 L4 U4 L4 L5 C5 U5 U4 U1 U3 U6 U2 L3 C4 C3 C5 U3
40 10 5 C2 L2 C3 C4 U2
19 1 8 C5 L2 U2 C5 C3 C1 C1 C5
26 9 25 L4 L2 L1 C5 U1 U2 C4 C2 L5 U5 U4 L4 U4 L4 L2 C3 C5 C3 U2 C5 L1 U1 C2 C1 U4
6 7 ...

output:

221
246
49
266
74
74
208
167
101
148

result:

ok 10 lines

Test #37:

score: 0
Accepted
time: 41ms
memory: 39228kb

input:

11 10
29 3 8 L1 L7 C4 L2 C5 U2 U7 U1
28 11 33 C2 C3 C4 L10 C5 U10 C3 L6 C1 U6 L4 L9 L8 C3 C1 C4 U8 C1 C4 C1 U9 C4 U4 C4 L4 C5 U4 L9 L2 C5 C1 U2 U9
26 4 21 L2 L7 L4 L8 L5 C1 C1 C1 L1 L3 C5 U3 U1 U5 C1 L6 U6 U8 U4 U7 U2
3 6 21 L1 C2 C2 C5 C3 C5 L10 U10 L9 L7 L8 C1 U8 U7 U9 L3 L8 C1 U8 U3 U1
2 5 17 L10...

output:

231
80
222
96
4
187
38
140
280
264
213

result:

ok 11 lines

Test #38:

score: 0
Accepted
time: 56ms
memory: 40292kb

input:

10 8
7 4 45 L1 L8 C3 C2 L5 C4 U5 C2 C2 C1 C4 L2 U2 L2 C5 U2 U8 U1 L6 L8 L4 L1 C2 C4 C1 C2 L2 L3 L5 U5 C2 U3 U2 U1 L2 U2 L5 U5 L1 L5 U5 U1 U4 U8 U6
32 5 2 C5 C5
32 9 27 L4 C3 C1 L5 U5 L1 C3 C3 L8 U8 C4 L7 C5 U7 C3 U1 L2 C5 U2 L5 L2 U2 C5 C5 C2 U5 U4
21 8 25 L5 L6 L1 L2 U2 U1 L8 L4 U4 U8 L2 U2 C3 L7 U...

output:

157
123
73
97
249
84
113
205
101
84

result:

ok 10 lines

Test #39:

score: 0
Accepted
time: 40ms
memory: 38860kb

input:

19 9
44 15 27 L8 C5 C5 C4 C4 U8 C4 L1 L6 L8 C2 U8 U6 L6 L4 U4 U6 L4 U4 L4 L5 U5 C2 C5 U4 U1 C2
50 17 28 L3 L7 L8 C5 C4 C2 C5 U8 L2 U2 L8 L2 L1 L5 U5 U1 C5 U2 L6 C5 C3 U6 U8 U7 L8 C1 U8 U3
26 8 7 L6 C1 L9 U9 C5 C1 U6
18 13 6 L9 C1 C4 L5 U5 U9
45 14 49 L3 L2 L8 L5 L6 U6 C2 C2 C1 U5 U8 U2 U3 L5 L8 L3 C...

output:

195
117
293
26
231
361
423
316
286
271
311
162
70
397
87
322
374
253
132

result:

ok 19 lines

Test #40:

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

input:

3 3
50 3 5 C1 C1 C1 C1 C1
3 2 4 C3 C3 C2 C2
1 1 3 C10 C5 C5

output:

55
13
31

result:

ok 3 lines

Test #41:

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

input:

3 1
5 3 5 C1 L1 C1 U1 C1
3 2 5 C1 L1 C1 U1 C1
1 1 5 C1 L1 C5 U1 C1

output:

11
13
14

result:

ok 3 lines

Test #42:

score: 0
Accepted
time: 40ms
memory: 37668kb

input:

3 2
4 3 3 L1 C1 U1
6 2 1 C9
1 1 7 L1 C1 L2 C9 U2 C9 U1

output:

21
30
20

result:

ok 3 lines

Test #43:

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

input:

4 2
2 2 1 C4
3 3 2 L1 U1
1 1 3 L2 C2 U2
4 4 2 L2 U2

output:

7
4
4
4

result:

ok 4 lines

Test #44:

score: 0
Accepted
time: 68ms
memory: 39820kb

input:

20 20
1 1 100 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U1 L1 U...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

result:

ok 20 lines

Test #45:

score: 0
Accepted
time: 126ms
memory: 53060kb

input:

20 20
1 1 100 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 L1 C100 U1 ...

output:

68001
64601
61201
57801
54401
51001
47601
44201
40801
37401
34001
30601
27201
23801
20401
17001
13601
10201
6801
3401

result:

ok 20 lines

Test #46:

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

input:

20 20
1 1 100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C...

output:

200001
190001
180001
170001
160001
150001
140001
130001
120001
110001
100001
90001
80001
70001
60001
50001
40001
30001
20001
10001

result:

ok 20 lines

Test #47:

score: 0
Accepted
time: 39ms
memory: 37160kb

input:

20 20
95 20 7 L20 C7 L1 C7 U1 C1 U20
90 19 7 L19 C7 L20 C7 U20 C1 U19
85 18 7 L18 C7 L19 C7 U19 C1 U18
80 17 7 L17 C7 L18 C7 U18 C1 U17
75 16 7 L16 C7 L17 C7 U17 C1 U16
70 15 7 L15 C7 L16 C7 U16 C1 U15
65 14 7 L14 C7 L15 C7 U15 C1 U14
60 13 7 L13 C7 L14 C7 U14 C1 U13
55 12 7 L12 C7 L13 C7 U13 C1 U12...

output:

118
133
148
163
178
193
208
223
238
253
268
283
298
313
328
343
358
373
388
103

result:

ok 20 lines

Test #48:

score: 0
Accepted
time: 44ms
memory: 37316kb

input:

2 2
5 2 5 L1 U1 C100 L2 U2
1 1 3 L2 C20 U2

output:

121
21

result:

ok 2 lines

Test #49:

score: 0
Accepted
time: 236ms
memory: 75648kb

input:

20 20
10000 20 100 L1 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C100 C10...

output:

29399
19599
48597
38997
67795
58195
86993
77393
106191
96591
125389
115789
144587
134987
163785
154185
182983
173383
202381
192781

result:

ok 20 lines