QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#101566#6380. LaLa and Divination MagicsmaxTL 1245ms218112kbC++238.2kb2023-04-30 11:40:322023-04-30 11:40:36

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #2:

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

input:

3 3
101
011
111

output:

12
0 0 2
0 0 3
0 1 4
2 2 4
1 0 4
1 1 2
1 1 3
2 2 4
2 2 4
2 2 4
2 2 4
2 2 4

result:

ok Kout = 12, Kans = 6

Test #3:

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

input:

2 1
0
1

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #4:

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

input:

2 1
0
1

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #5:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #6:

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

input:

2 1
0
1

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #7:

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

input:

2 1
0
1

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #8:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #9:

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

input:

1 1
1

output:

2
0 0 4
0 0 4

result:

ok Kout = 2, Kans = 1

Test #10:

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

input:

1 1
0

output:

2
0 0 1
0 0 1

result:

ok Kout = 2, Kans = 1

Test #11:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #12:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #13:

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

input:

2 4
0111
0010

output:

24
0 0 1
0 0 1
0 0 1
0 0 1
2 2 4
0 0 1
0 0 1
1 1 2
1 1 3
2 2 4
1 3 2
1 3 3
2 2 4
0 0 1
2 2 4
2 2 4
2 2 4
2 2 4
0 0 1
3 1 2
3 1 3
2 2 4
3 3 2
3 3 3

result:

ok Kout = 24, Kans = 15

Test #14:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #15:

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

input:

4 2
10
11
01
00

output:

4
0 0 2
0 0 3
1 1 2
1 1 3

result:

ok Kout = 4, Kans = 0

Test #16:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #17:

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

input:

2 4
0010
1000

output:

24
0 0 2
0 0 3
1 1 1
0 2 1
0 2 4
3 3 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
3 3 1
2 0 1
2 0 4
1 1 1
2 2 2
2 2 3
3 3 1
3 3 1
3 3 1
1 1 1
3 3 1
3 3 1
3 3 1

result:

ok Kout = 24, Kans = 15

Test #18:

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

input:

2 5
11101
00000

output:

42
0 0 2
0 0 3
0 1 2
0 1 3
0 2 2
0 2 3
3 3 1
0 4 2
0 4 3
1 0 2
1 0 3
1 1 2
1 1 3
1 2 2
1 2 3
3 3 1
1 4 2
1 4 3
2 0 2
2 0 3
2 1 2
2 1 3
2 2 2
2 2 3
3 3 1
2 4 2
2 4 3
3 3 1
3 3 1
3 3 1
3 3 1
3 3 1
3 3 1
4 0 2
4 0 3
4 1 2
4 1 3
4 2 2
4 2 3
3 3 1
4 4 2
4 4 3

result:

ok Kout = 42, Kans = 21

Test #19:

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

input:

5 4
0010
1001
0011
0101
1011

output:

-1

result:

ok Kout = -1, Kans = -1

Test #20:

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

input:

3 2
01
00
10

output:

6
0 0 2
0 0 3
0 1 1
1 0 1
1 1 2
1 1 3

result:

ok Kout = 6, Kans = 1

Test #21:

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

input:

3 2
10
11
00

output:

6
0 0 2
0 0 3
0 1 2
1 0 3
1 1 2
1 1 3

result:

ok Kout = 6, Kans = 1

Test #22:

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

input:

2 1
0
1

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #23:

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

input:

3 27
111010110011101010011110110
010001110100000110100101101
000011111000000010011111001

output:

-1

result:

ok Kout = -1, Kans = -1

Test #24:

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

input:

3 7
1000100
0001100
0101111

output:

66
0 0 2
0 0 3
0 1 1
2 2 1
0 3 1
0 3 4
4 4 4
0 5 1
0 6 1
1 0 1
1 1 2
1 1 3
2 2 1
1 3 3
4 4 4
1 5 2
1 5 3
1 6 2
1 6 3
2 2 1
2 2 1
2 2 1
2 2 1
2 2 1
2 2 1
4 4 4
2 2 1
2 2 1
3 0 1
3 0 4
3 1 2
2 2 1
3 3 2
3 3 3
4 4 4
3 5 2
3 6 2
4 4 4
4 4 4
4 4 4
2 2 1
4 4 4
4 4 4
4 4 4
4 4 4
4 4 4
5 0 1
5 1 2
5 1 3
2 2...

result:

ok Kout = 66, Kans = 39

Test #25:

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

input:

1 19
1010110011001101000

output:

722
0 0 4
0 0 4
0 0 4
1 1 1
0 0 4
2 2 4
0 0 4
3 3 1
0 0 4
4 4 4
0 0 4
5 5 4
0 0 4
6 6 1
0 0 4
7 7 1
0 0 4
8 8 4
0 0 4
9 9 4
0 0 4
10 10 1
0 0 4
11 11 1
0 0 4
12 12 4
0 0 4
13 13 4
0 0 4
14 14 1
0 0 4
15 15 4
0 0 4
16 16 1
0 0 4
17 17 1
0 0 4
18 18 1
1 1 1
0 0 4
1 1 1
1 1 1
1 1 1
2 2 4
1 1 1
3 3 1
1 ...

result:

ok Kout = 722, Kans = 532

Test #26:

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

input:

5 32
10101101001001001101111100100110
00110110010111010101011000011010
01010101110100000110001000010100
11010011000110101101110001011111
00111001110011110000000010000111

output:

-1

result:

ok Kout = -1, Kans = -1

Test #27:

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

input:

3 12
110010101000
110001011000
110101011001

output:

200
0 0 4
0 0 4
0 0 4
1 1 4
0 0 4
2 2 1
0 0 4
0 0 4
0 0 4
0 0 4
0 0 4
0 0 4
8 8 4
0 0 4
9 9 1
0 0 4
10 10 1
0 0 4
1 1 4
0 0 4
1 1 4
1 1 4
1 1 4
2 2 1
1 1 4
1 1 4
1 1 4
1 1 4
1 1 4
1 1 4
8 8 4
1 1 4
9 9 1
1 1 4
10 10 1
1 1 4
2 2 1
0 0 4
2 2 1
1 1 4
2 2 1
2 2 1
2 2 1
2 2 1
2 2 1
2 2 1
2 2 1
2 2 1
8 8 ...

result:

ok Kout = 200, Kans = 145

Test #28:

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

input:

3 25
1110100100011100101100111
0100000001011101101010101
0111110111111001001110111

output:

-1

result:

ok Kout = -1, Kans = -1

Test #29:

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

input:

1 5
10110

output:

50
0 0 4
0 0 4
0 0 4
1 1 1
0 0 4
2 2 4
0 0 4
3 3 4
0 0 4
4 4 1
1 1 1
0 0 4
1 1 1
1 1 1
1 1 1
2 2 4
1 1 1
3 3 4
1 1 1
4 4 1
2 2 4
0 0 4
2 2 4
1 1 1
2 2 4
2 2 4
2 2 4
3 3 4
2 2 4
4 4 1
3 3 4
0 0 4
3 3 4
1 1 1
3 3 4
2 2 4
3 3 4
3 3 4
3 3 4
4 4 1
4 4 1
0 0 4
4 4 1
1 1 1
4 4 1
2 2 4
4 4 1
3 3 4
4 4 1
4 4 1

result:

ok Kout = 50, Kans = 35

Test #30:

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

input:

5 17
01011100010100110
01001101111011001
00100111001101010
10101000001010110
00101011010010001

output:

-1

result:

ok Kout = -1, Kans = -1

Test #31:

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

input:

3 30
010100010011100011010001010100
011111100101001100010101010010
011000010111111111000101101110

output:

-1

result:

ok Kout = -1, Kans = -1

Test #32:

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

input:

5 30
110010101001001100010110010000
011011111000011001101000100000
110101010111000000100100111000
001111011110101101101001101011
101100001101011110101010110000

output:

-1

result:

ok Kout = -1, Kans = -1

Test #33:

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

input:

10 10
0110101111
1100100000
1000101100
1000010101
1001011101
1011101101
1011111011
0101010000
0111011010
1111010110

output:

-1

result:

ok Kout = -1, Kans = -1

Test #34:

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

input:

9 10
1000001101
0110010110
1011101111
1010001110
1110001000
1001110110
1101010010
0001011111
1000010100

output:

-1

result:

ok Kout = -1, Kans = -1

Test #35:

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

input:

3 5
11111
01000
01100

output:

36
0 0 2
0 0 3
1 1 4
0 2 3
0 3 2
0 3 3
0 4 2
0 4 3
1 1 4
1 1 4
1 1 4
1 1 4
1 1 4
1 1 4
2 0 2
1 1 4
2 2 2
2 2 3
2 3 2
2 4 2
3 0 2
3 0 3
1 1 4
3 2 3
3 3 2
3 3 3
3 4 2
3 4 3
4 0 2
4 0 3
1 1 4
4 2 3
4 3 2
4 3 3
4 4 2
4 4 3

result:

ok Kout = 36, Kans = 18

Test #36:

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

input:

7 9
000010100
101001100
110010111
000000110
100010101
101000100
101101100

output:

-1

result:

ok Kout = -1, Kans = -1

Test #37:

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

input:

1 4
0000

output:

32
0 0 1
0 0 1
0 0 1
1 1 1
0 0 1
2 2 1
0 0 1
3 3 1
1 1 1
0 0 1
1 1 1
1 1 1
1 1 1
2 2 1
1 1 1
3 3 1
2 2 1
0 0 1
2 2 1
1 1 1
2 2 1
2 2 1
2 2 1
3 3 1
3 3 1
0 0 1
3 3 1
1 1 1
3 3 1
2 2 1
3 3 1
3 3 1

result:

ok Kout = 32, Kans = 22

Test #38:

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

input:

9 8
10011110
10111101
11001010
01000101
10110011
00101001
00101100
11010110
01000000

output:

-1

result:

ok Kout = -1, Kans = -1

Test #39:

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

input:

3 10
0000000111
1011011111
0101111010

output:

-1

result:

ok Kout = -1, Kans = -1

Test #40:

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

input:

2 1
1
0

output:

2
0 0 2
0 0 3

result:

ok Kout = 2, Kans = 0

Test #41:

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

input:

1 5
00110

output:

50
0 0 1
0 0 1
0 0 1
1 1 1
0 0 1
2 2 4
0 0 1
3 3 4
0 0 1
4 4 1
1 1 1
0 0 1
1 1 1
1 1 1
1 1 1
2 2 4
1 1 1
3 3 4
1 1 1
4 4 1
2 2 4
0 0 1
2 2 4
1 1 1
2 2 4
2 2 4
2 2 4
3 3 4
2 2 4
4 4 1
3 3 4
0 0 1
3 3 4
1 1 1
3 3 4
2 2 4
3 3 4
3 3 4
3 3 4
4 4 1
4 4 1
0 0 1
4 4 1
1 1 1
4 4 1
2 2 4
4 4 1
3 3 4
4 4 1
4 4 1

result:

ok Kout = 50, Kans = 35

Test #42:

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

input:

6 9
100101111
100001110
100101010
001101000
101100010
010101110

output:

-1

result:

ok Kout = -1, Kans = -1

Test #43:

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

input:

6 836
001111110001001001101010101010011100010100100100111110110100101000100100000000011101110001011100111111111001101111111101101110010011000100100111111101011010101101011101010000100011100011000011111011011110000001010101001101110100001111111001000110111000010110001100110010010000101011001010101100...

output:

-1

result:

ok Kout = -1, Kans = -1

Test #44:

score: 0
Accepted
time: 1245ms
memory: 218112kb

input:

1 1680
00110010011001010101000101001110100010100110000110011101101101011011011011011011000000100100001111110111011001000010100101111110011000011110001000000001001010010110001011101000000110011010000001101010010000101111000010110001001010000010001010110000110111011011001011010011100111110000100110110...

output:

5644800
0 0 1
0 0 1
0 0 1
1 1 1
0 0 1
2 2 4
0 0 1
3 3 4
0 0 1
4 4 1
0 0 1
5 5 1
0 0 1
6 6 4
0 0 1
7 7 1
0 0 1
8 8 1
0 0 1
9 9 4
0 0 1
10 10 4
0 0 1
11 11 1
0 0 1
12 12 1
0 0 1
13 13 4
0 0 1
14 14 1
0 0 1
15 15 4
0 0 1
16 16 1
0 0 1
17 17 4
0 0 1
18 18 1
0 0 1
19 19 4
0 0 1
20 20 1
0 0 1
21 21 1
0 0 ...

result:

ok Kout = 5644800, Kans = 4232760

Test #45:

score: 0
Accepted
time: 15ms
memory: 11676kb

input:

5 525
010011011010110111000101111001010011110110100011110111000110010010000011011011110001110100110101101111111001100010010011011011011101110010011011001111110100010011011001010111011001100011001000101100111000000100010100011011011110101010000011101110001001000000100101000000101011101010110101010110...

output:

-1

result:

ok Kout = -1, Kans = -1

Test #46:

score: -100
Time Limit Exceeded

input:

9 1369
10111110110000010001000001110000001000010000101111010111111000100001001011101000101011000111001000010110010100011001110101100010000010000010100010011100110011000011110001001001010100010100001111111000111110100100010000100100110111110101100011010100000011000011010111111101011001011001010010110...

output:


result: