Toggle navigation
Bulletin
Problems
Submissions
Contests
Discuss
About
Rank
Sign in
Sign up
×
Close
2022 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2023 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2024 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2259 . I. 鐵路鋪設
Submit
Status
Discussion / Solution
Ranklist
Back to Problems List
TopCoder
Caido
$\mathbb{W}\mathcal{aimai}\sim$
User's AC Ratio
94.8% (
55/58
)
Submission's AC Ratio
48.7% (
76
/
156
)
Tags
Show solution-related tags
全國賽
2021-全國賽
nhspc110
Description
題目 PDF 檔在這裡
Input Format
Output Format
Sample Input 1
copy
3
Sample Output 1
copy
3
Sample Input 2
copy
10
Sample Output 2
copy
686
Sample Input 3
copy
327
Sample Output 3
copy
265488547
Hints
Problem Source
110 學年度全國資訊學科能力競賽
測資來源:
TWPCA GitHub
Subtasks
No.
Testdata Range
Constraints
Score
1
0~2
範例測資。
0
2
3~9
$L \le 7$
10
3
10~42
$L \le 10 ^ 3$
20
4
43~143
$L \le 10 ^ 5$
34
5
144~244
無額外限制。
36
Testdata and Limits
No.
Time Limit (ms)
Memory Limit (VSS, KiB)
Output Limit (KiB)
Subtasks
0
100
1048576
65536
1
1
100
1048576
65536
1
2
100
1048576
65536
1
3
100
1048576
65536
2
4
100
1048576
65536
2
5
100
1048576
65536
2
6
100
1048576
65536
2
7
100
1048576
65536
2
8
100
1048576
65536
2
9
100
1048576
65536
2
10
100
1048576
65536
3
11
100
1048576
65536
3
12
100
1048576
65536
3
13
100
1048576
65536
3
14
100
1048576
65536
3
15
100
1048576
65536
3
16
100
1048576
65536
3
17
100
1048576
65536
3
18
100
1048576
65536
3
19
100
1048576
65536
3
20
100
1048576
65536
3
21
100
1048576
65536
3
22
100
1048576
65536
3
23
100
1048576
65536
3
24
100
1048576
65536
3
25
100
1048576
65536
3
26
100
1048576
65536
3
27
100
1048576
65536
3
28
100
1048576
65536
3
29
100
1048576
65536
3
30
100
1048576
65536
3
31
100
1048576
65536
3
32
100
1048576
65536
3
33
100
1048576
65536
3
34
100
1048576
65536
3
35
100
1048576
65536
3
36
100
1048576
65536
3
37
100
1048576
65536
3
38
100
1048576
65536
3
39
100
1048576
65536
3
40
100
1048576
65536
3
41
100
1048576
65536
3
42
100
1048576
65536
3
43
100
1048576
65536
4
44
100
1048576
65536
4
45
100
1048576
65536
4
46
100
1048576
65536
4
47
100
1048576
65536
4
48
100
1048576
65536
4
49
100
1048576
65536
4
50
100
1048576
65536
4
51
100
1048576
65536
4
52
100
1048576
65536
4
53
100
1048576
65536
4
54
100
1048576
65536
4
55
100
1048576
65536
4
56
100
1048576
65536
4
57
100
1048576
65536
4
58
100
1048576
65536
4
59
100
1048576
65536
4
60
100
1048576
65536
4
61
100
1048576
65536
4
62
100
1048576
65536
4
63
100
1048576
65536
4
64
100
1048576
65536
4
65
100
1048576
65536
4
66
100
1048576
65536
4
67
100
1048576
65536
4
68
100
1048576
65536
4
69
100
1048576
65536
4
70
100
1048576
65536
4
71
100
1048576
65536
4
72
100
1048576
65536
4
73
100
1048576
65536
4
74
100
1048576
65536
4
75
100
1048576
65536
4
76
100
1048576
65536
4
77
100
1048576
65536
4
78
100
1048576
65536
4
79
100
1048576
65536
4
80
100
1048576
65536
4
81
100
1048576
65536
4
82
100
1048576
65536
4
83
100
1048576
65536
4
84
100
1048576
65536
4
85
100
1048576
65536
4
86
100
1048576
65536
4
87
100
1048576
65536
4
88
100
1048576
65536
4
89
100
1048576
65536
4
90
100
1048576
65536
4
91
100
1048576
65536
4
92
100
1048576
65536
4
93
100
1048576
65536
4
94
100
1048576
65536
4
95
100
1048576
65536
4
96
100
1048576
65536
4
97
100
1048576
65536
4
98
100
1048576
65536
4
99
100
1048576
65536
4
100
100
1048576
65536
4
101
100
1048576
65536
4
102
100
1048576
65536
4
103
100
1048576
65536
4
104
100
1048576
65536
4
105
100
1048576
65536
4
106
100
1048576
65536
4
107
100
1048576
65536
4
108
100
1048576
65536
4
109
100
1048576
65536
4
110
100
1048576
65536
4
111
100
1048576
65536
4
112
100
1048576
65536
4
113
100
1048576
65536
4
114
100
1048576
65536
4
115
100
1048576
65536
4
116
100
1048576
65536
4
117
100
1048576
65536
4
118
100
1048576
65536
4
119
100
1048576
65536
4
120
100
1048576
65536
4
121
100
1048576
65536
4
122
100
1048576
65536
4
123
100
1048576
65536
4
124
100
1048576
65536
4
125
100
1048576
65536
4
126
100
1048576
65536
4
127
100
1048576
65536
4
128
100
1048576
65536
4
129
100
1048576
65536
4
130
100
1048576
65536
4
131
100
1048576
65536
4
132
100
1048576
65536
4
133
100
1048576
65536
4
134
100
1048576
65536
4
135
100
1048576
65536
4
136
100
1048576
65536
4
137
100
1048576
65536
4
138
100
1048576
65536
4
139
100
1048576
65536
4
140
100
1048576
65536
4
141
100
1048576
65536
4
142
100
1048576
65536
4
143
100
1048576
65536
4
144
100
1048576
65536
5
145
100
1048576
65536
5
146
100
1048576
65536
5
147
100
1048576
65536
5
148
100
1048576
65536
5
149
100
1048576
65536
5
150
100
1048576
65536
5
151
100
1048576
65536
5
152
100
1048576
65536
5
153
100
1048576
65536
5
154
100
1048576
65536
5
155
100
1048576
65536
5
156
100
1048576
65536
5
157
100
1048576
65536
5
158
100
1048576
65536
5
159
100
1048576
65536
5
160
100
1048576
65536
5
161
100
1048576
65536
5
162
100
1048576
65536
5
163
100
1048576
65536
5
164
100
1048576
65536
5
165
100
1048576
65536
5
166
100
1048576
65536
5
167
100
1048576
65536
5
168
100
1048576
65536
5
169
100
1048576
65536
5
170
100
1048576
65536
5
171
100
1048576
65536
5
172
100
1048576
65536
5
173
100
1048576
65536
5
174
100
1048576
65536
5
175
100
1048576
65536
5
176
100
1048576
65536
5
177
100
1048576
65536
5
178
100
1048576
65536
5
179
100
1048576
65536
5
180
100
1048576
65536
5
181
100
1048576
65536
5
182
100
1048576
65536
5
183
100
1048576
65536
5
184
100
1048576
65536
5
185
100
1048576
65536
5
186
100
1048576
65536
5
187
100
1048576
65536
5
188
100
1048576
65536
5
189
100
1048576
65536
5
190
100
1048576
65536
5
191
100
1048576
65536
5
192
100
1048576
65536
5
193
100
1048576
65536
5
194
100
1048576
65536
5
195
100
1048576
65536
5
196
100
1048576
65536
5
197
100
1048576
65536
5
198
100
1048576
65536
5
199
100
1048576
65536
5
200
100
1048576
65536
5
201
100
1048576
65536
5
202
100
1048576
65536
5
203
100
1048576
65536
5
204
100
1048576
65536
5
205
100
1048576
65536
5
206
100
1048576
65536
5
207
100
1048576
65536
5
208
100
1048576
65536
5
209
100
1048576
65536
5
210
100
1048576
65536
5
211
100
1048576
65536
5
212
100
1048576
65536
5
213
100
1048576
65536
5
214
100
1048576
65536
5
215
100
1048576
65536
5
216
100
1048576
65536
5
217
100
1048576
65536
5
218
100
1048576
65536
5
219
100
1048576
65536
5
220
100
1048576
65536
5
221
100
1048576
65536
5
222
100
1048576
65536
5
223
100
1048576
65536
5
224
100
1048576
65536
5
225
100
1048576
65536
5
226
100
1048576
65536
5
227
100
1048576
65536
5
228
100
1048576
65536
5
229
100
1048576
65536
5
230
100
1048576
65536
5
231
100
1048576
65536
5
232
100
1048576
65536
5
233
100
1048576
65536
5
234
100
1048576
65536
5
235
100
1048576
65536
5
236
100
1048576
65536
5
237
100
1048576
65536
5
238
100
1048576
65536
5
239
100
1048576
65536
5
240
100
1048576
65536
5
241
100
1048576
65536
5
242
100
1048576
65536
5
243
100
1048576
65536
5
244
100
1048576
65536
5
Submit
Back to Top