Toggle navigation
Bulletin
Problems
Submissions
Contests
Discuss
About
Rank
Sign in
Sign up
×
Close
2022 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2023 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2024 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2394 . 荒野大飆馬
Submit
Status
Discussion / Solution
Ranklist
Back to Problems List
TopCoder
huangallen
🔥🐥
User's AC Ratio
90.9% (
10/11
)
Submission's AC Ratio
85.7% (
12
/
14
)
Tags
Show solution-related tags
pre-nhspc-2024
全國模擬賽
Description
題目 PDF 檔在這裡
Input Format
Output Format
Sample Input 1
copy
5
1 2 3 4 5
1 3 2 6 7
2 3 9 11 9
Sample Output 1
copy
Yes
1 2 3 4 5
1 3 3 6 7
Sample Input 2
copy
5
0 2 0 3 0
1 2 3 3 4
2 4 4 4 5
Sample Output 2
copy
Yes
1 2 4 3 5
1 2 3 3 4
Sample Input 3
copy
5
0 2 0 1 0
1 2 3 4 1
2 3 4 5 5
Sample Output 3
copy
No
Hints
Problem Source
113 學年度全國資訊學科能力競賽模擬賽
Subtasks
No.
Testdata Range
Constraints
Score
1
0~2
範例測資
0
2
3~21
$p_i\neq 0$
13
3
22~36
$p_i=0$
8
4
0~2, 37~71
$N\le 20$
11
5
0~2, 37~100
$N\le 3000$
30
6
0~189
無額外限制
38
Testdata and Limits
No.
Time Limit (ms)
Memory Limit (VSS, KiB)
Output Limit (KiB)
Subtasks
0
1000
524288
65536
1
4
5
6
1
1000
524288
65536
1
4
5
6
2
1000
524288
65536
1
4
5
6
3
1000
524288
65536
2
6
4
1000
524288
65536
2
6
5
1000
524288
65536
2
6
6
1000
524288
65536
2
6
7
1000
524288
65536
2
6
8
1000
524288
65536
2
6
9
1000
524288
65536
2
6
10
1000
524288
65536
2
6
11
1000
524288
65536
2
6
12
1000
524288
65536
2
6
13
1000
524288
65536
2
6
14
1000
524288
65536
2
6
15
1000
524288
65536
2
6
16
1000
524288
65536
2
6
17
1000
524288
65536
2
6
18
1000
524288
65536
2
6
19
1000
524288
65536
2
6
20
1000
524288
65536
2
6
21
1000
524288
65536
2
6
22
1000
524288
65536
3
6
23
1000
524288
65536
3
6
24
1000
524288
65536
3
6
25
1000
524288
65536
3
6
26
1000
524288
65536
3
6
27
1000
524288
65536
3
6
28
1000
524288
65536
3
6
29
1000
524288
65536
3
6
30
1000
524288
65536
3
6
31
1000
524288
65536
3
6
32
1000
524288
65536
3
6
33
1000
524288
65536
3
6
34
1000
524288
65536
3
6
35
1000
524288
65536
3
6
36
1000
524288
65536
3
6
37
1000
524288
65536
4
5
6
38
1000
524288
65536
4
5
6
39
1000
524288
65536
4
5
6
40
1000
524288
65536
4
5
6
41
1000
524288
65536
4
5
6
42
1000
524288
65536
4
5
6
43
1000
524288
65536
4
5
6
44
1000
524288
65536
4
5
6
45
1000
524288
65536
4
5
6
46
1000
524288
65536
4
5
6
47
1000
524288
65536
4
5
6
48
1000
524288
65536
4
5
6
49
1000
524288
65536
4
5
6
50
1000
524288
65536
4
5
6
51
1000
524288
65536
4
5
6
52
1000
524288
65536
4
5
6
53
1000
524288
65536
4
5
6
54
1000
524288
65536
4
5
6
55
1000
524288
65536
4
5
6
56
1000
524288
65536
4
5
6
57
1000
524288
65536
4
5
6
58
1000
524288
65536
4
5
6
59
1000
524288
65536
4
5
6
60
1000
524288
65536
4
5
6
61
1000
524288
65536
4
5
6
62
1000
524288
65536
4
5
6
63
1000
524288
65536
4
5
6
64
1000
524288
65536
4
5
6
65
1000
524288
65536
4
5
6
66
1000
524288
65536
4
5
6
67
1000
524288
65536
4
5
6
68
1000
524288
65536
4
5
6
69
1000
524288
65536
4
5
6
70
1000
524288
65536
4
5
6
71
1000
524288
65536
4
5
6
72
1000
524288
65536
5
6
73
1000
524288
65536
5
6
74
1000
524288
65536
5
6
75
1000
524288
65536
5
6
76
1000
524288
65536
5
6
77
1000
524288
65536
5
6
78
1000
524288
65536
5
6
79
1000
524288
65536
5
6
80
1000
524288
65536
5
6
81
1000
524288
65536
5
6
82
1000
524288
65536
5
6
83
1000
524288
65536
5
6
84
1000
524288
65536
5
6
85
1000
524288
65536
5
6
86
1000
524288
65536
5
6
87
1000
524288
65536
5
6
88
1000
524288
65536
5
6
89
1000
524288
65536
5
6
90
1000
524288
65536
5
6
91
1000
524288
65536
5
6
92
1000
524288
65536
5
6
93
1000
524288
65536
5
6
94
1000
524288
65536
5
6
95
1000
524288
65536
5
6
96
1000
524288
65536
5
6
97
1000
524288
65536
5
6
98
1000
524288
65536
5
6
99
1000
524288
65536
5
6
100
1000
524288
65536
5
6
101
1000
524288
65536
6
102
1000
524288
65536
6
103
1000
524288
65536
6
104
1000
524288
65536
6
105
1000
524288
65536
6
106
1000
524288
65536
6
107
1000
524288
65536
6
108
1000
524288
65536
6
109
1000
524288
65536
6
110
1000
524288
65536
6
111
1000
524288
65536
6
112
1000
524288
65536
6
113
1000
524288
65536
6
114
1000
524288
65536
6
115
1000
524288
65536
6
116
1000
524288
65536
6
117
1000
524288
65536
6
118
1000
524288
65536
6
119
1000
524288
65536
6
120
1000
524288
65536
6
121
1000
524288
65536
6
122
1000
524288
65536
6
123
1000
524288
65536
6
124
1000
524288
65536
6
125
1000
524288
65536
6
126
1000
524288
65536
6
127
1000
524288
65536
6
128
1000
524288
65536
6
129
1000
524288
65536
6
130
1000
524288
65536
6
131
1000
524288
65536
6
132
1000
524288
65536
6
133
1000
524288
65536
6
134
1000
524288
65536
6
135
1000
524288
65536
6
136
1000
524288
65536
6
137
1000
524288
65536
6
138
1000
524288
65536
6
139
1000
524288
65536
6
140
1000
524288
65536
6
141
1000
524288
65536
6
142
1000
524288
65536
6
143
1000
524288
65536
6
144
1000
524288
65536
6
145
1000
524288
65536
6
146
1000
524288
65536
6
147
1000
524288
65536
6
148
1000
524288
65536
6
149
1000
524288
65536
6
150
1000
524288
65536
6
151
1000
524288
65536
6
152
1000
524288
65536
6
153
1000
524288
65536
6
154
1000
524288
65536
6
155
1000
524288
65536
6
156
1000
524288
65536
6
157
1000
524288
65536
6
158
1000
524288
65536
6
159
1000
524288
65536
6
160
1000
524288
65536
6
161
1000
524288
65536
6
162
1000
524288
65536
6
163
1000
524288
65536
6
164
1000
524288
65536
6
165
1000
524288
65536
6
166
1000
524288
65536
6
167
1000
524288
65536
6
168
1000
524288
65536
6
169
1000
524288
65536
6
170
1000
524288
65536
6
171
1000
524288
65536
6
172
1000
524288
65536
6
173
1000
524288
65536
6
174
1000
524288
65536
6
175
1000
524288
65536
6
176
1000
524288
65536
6
177
1000
524288
65536
6
178
1000
524288
65536
6
179
1000
524288
65536
6
180
1000
524288
65536
6
181
1000
524288
65536
6
182
1000
524288
65536
6
183
1000
524288
65536
6
184
1000
524288
65536
6
185
1000
524288
65536
6
186
1000
524288
65536
6
187
1000
524288
65536
6
188
1000
524288
65536
6
189
1000
524288
65536
6
Submit
Back to Top