TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

User's AC Ratio

50.0% (1/2)

Submission's AC Ratio

15.8% (3/19)

Tags

Description

Input Format

Output Format

Sample Input 1

4 5 1 2
X?..
X.X?
?X??
XX?.
?X?X
1 1 4
2 1 4

Sample Output 1

1
1

Sample Input 2

3 5 1 2
.?.
.?X
X?X
X?X
X?X
1 1 2
1 2 3

Sample Output 2

2
4

Sample Input 3

4 2 1 2
X.X.
X.X.
2 1 4
0 2 3

Sample Output 3

2
0

Sample Input 4

6 6 2 7
?.?..?
??.X.?
?X?X.?
?X??XX
.X???X
??XX??
0 4 6
3 1 6
2 2 5
0 4 5
1 3 5
1 5 6
2 1 4

Sample Output 4

0
12
4
0
4
3
9

Hints

Problem Source

113 學年度全國資訊學科能力競賽模擬賽

Subtasks

No. Testdata Range Constraints Score
1 0~3 範例測資 0
2 4~34 $n\le 1000,q=1$ 13
3 35~49 $K=1,q\le 2\times 10^ 5, m=1$ 16
4 35~78 $K\le 3,q\le 2\times 10^ 5$ 37
5 0~126 無額外限制 34

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 8000 2097152 65536 1 5
1 8000 2097152 65536 1 5
2 8000 2097152 65536 1 5
3 8000 2097152 65536 1 5
4 8000 2097152 65536 2 5
5 8000 2097152 65536 2 5
6 8000 2097152 65536 2 5
7 8000 2097152 65536 2 5
8 8000 2097152 65536 2 5
9 8000 2097152 65536 2 5
10 8000 2097152 65536 2 5
11 8000 2097152 65536 2 5
12 8000 2097152 65536 2 5
13 8000 2097152 65536 2 5
14 8000 2097152 65536 2 5
15 8000 2097152 65536 2 5
16 8000 2097152 65536 2 5
17 8000 2097152 65536 2 5
18 8000 2097152 65536 2 5
19 8000 2097152 65536 2 5
20 8000 2097152 65536 2 5
21 8000 2097152 65536 2 5
22 8000 2097152 65536 2 5
23 8000 2097152 65536 2 5
24 8000 2097152 65536 2 5
25 8000 2097152 65536 2 5
26 8000 2097152 65536 2 5
27 8000 2097152 65536 2 5
28 8000 2097152 65536 2 5
29 8000 2097152 65536 2 5
30 8000 2097152 65536 2 5
31 8000 2097152 65536 2 5
32 8000 2097152 65536 2 5
33 8000 2097152 65536 2 5
34 8000 2097152 65536 2 5
35 8000 2097152 65536 3 4 5
36 8000 2097152 65536 3 4 5
37 8000 2097152 65536 3 4 5
38 8000 2097152 65536 3 4 5
39 8000 2097152 65536 3 4 5
40 8000 2097152 65536 3 4 5
41 8000 2097152 65536 3 4 5
42 8000 2097152 65536 3 4 5
43 8000 2097152 65536 3 4 5
44 8000 2097152 65536 3 4 5
45 8000 2097152 65536 3 4 5
46 8000 2097152 65536 3 4 5
47 8000 2097152 65536 3 4 5
48 8000 2097152 65536 3 4 5
49 8000 2097152 65536 3 4 5
50 8000 2097152 65536 4 5
51 8000 2097152 65536 4 5
52 8000 2097152 65536 4 5
53 8000 2097152 65536 4 5
54 8000 2097152 65536 4 5
55 8000 2097152 65536 4 5
56 8000 2097152 65536 4 5
57 8000 2097152 65536 4 5
58 8000 2097152 65536 4 5
59 8000 2097152 65536 4 5
60 8000 2097152 65536 4 5
61 8000 2097152 65536 4 5
62 8000 2097152 65536 4 5
63 8000 2097152 65536 4 5
64 8000 2097152 65536 4 5
65 8000 2097152 65536 4 5
66 8000 2097152 65536 4 5
67 8000 2097152 65536 4 5
68 8000 2097152 65536 4 5
69 8000 2097152 65536 4 5
70 8000 2097152 65536 4 5
71 8000 2097152 65536 4 5
72 8000 2097152 65536 4 5
73 8000 2097152 65536 4 5
74 8000 2097152 65536 4 5
75 8000 2097152 65536 4 5
76 8000 2097152 65536 4 5
77 8000 2097152 65536 4 5
78 8000 2097152 65536 4 5
79 8000 2097152 65536 5
80 8000 2097152 65536 5
81 8000 2097152 65536 5
82 8000 2097152 65536 5
83 8000 2097152 65536 5
84 8000 2097152 65536 5
85 8000 2097152 65536 5
86 8000 2097152 65536 5
87 8000 2097152 65536 5
88 8000 2097152 65536 5
89 8000 2097152 65536 5
90 8000 2097152 65536 5
91 8000 2097152 65536 5
92 8000 2097152 65536 5
93 8000 2097152 65536 5
94 8000 2097152 65536 5
95 8000 2097152 65536 5
96 8000 2097152 65536 5
97 8000 2097152 65536 5
98 8000 2097152 65536 5
99 8000 2097152 65536 5
100 8000 2097152 65536 5
101 8000 2097152 65536 5
102 8000 2097152 65536 5
103 8000 2097152 65536 5
104 8000 2097152 65536 5
105 8000 2097152 65536 5
106 8000 2097152 65536 5
107 8000 2097152 65536 5
108 8000 2097152 65536 5
109 8000 2097152 65536 5
110 8000 2097152 65536 5
111 8000 2097152 65536 5
112 8000 2097152 65536 5
113 8000 2097152 65536 5
114 8000 2097152 65536 5
115 8000 2097152 65536 5
116 8000 2097152 65536 5
117 8000 2097152 65536 5
118 8000 2097152 65536 5
119 8000 2097152 65536 5
120 8000 2097152 65536 5
121 8000 2097152 65536 5
122 8000 2097152 65536 5
123 8000 2097152 65536 5
124 8000 2097152 65536 5
125 8000 2097152 65536 5
126 8000 2097152 65536 5