Toggle navigation
Bulletin
Problems
Submissions
Contests
Discuss
About
Rank
Sign in
Sign up
×
Close
2022 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2023 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2024 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2391 . 種小黃瓜
Submit
Status
Discussion / Solution
Ranklist
Back to Problems List
TopCoder
AA 競程
AA 競程是最強的!
User's AC Ratio
100.0% (
11/11
)
Submission's AC Ratio
51.6% (
16
/
31
)
Tags
Show solution-related tags
pre-nhspc-2024
全國模擬賽
Description
題目 PDF 檔在這裡
Input Format
Output Format
Sample Input 1
copy
2
11 41
8
2 1
-1 -1
Sample Output 1
copy
11 19
Sample Input 2
copy
3
10 32123432332 4322214322123
71 22
1 2 3
-1 1 -1
Sample Output 2
copy
10 1 23
Sample Input 3
copy
10
4 14 12 6 12 19 12 18 18 1
3 2 0 8 7 3 0 2 9
3 10 1 8 2 9 6 4 7 5
1 -1 -1 1 1 -1 1 -1 1 1
Sample Output 3
copy
4 1 1 1 1 1 1 1 3 1
Hints
Problem Source
113 學年度全國資訊學科能力競賽模擬賽
Subtasks
No.
Testdata Range
Constraints
Score
1
0~2
範例測資
0
2
3~16, 23~41
$x_i=-1$
19
3
3~22, 42~50
$p_i=i$
14
4
0~9, 17~27, 51~66
$n\le 5000$
16
5
0~95
無額外限制
51
Testdata and Limits
No.
Time Limit (ms)
Memory Limit (VSS, KiB)
Output Limit (KiB)
Subtasks
0
2000
524288
65536
1
4
5
1
2000
524288
65536
1
4
5
2
2000
524288
65536
1
4
5
3
2000
524288
65536
2
3
4
5
4
2000
524288
65536
2
3
4
5
5
2000
524288
65536
2
3
4
5
6
2000
524288
65536
2
3
4
5
7
2000
524288
65536
2
3
4
5
8
2000
524288
65536
2
3
4
5
9
2000
524288
65536
2
3
4
5
10
2000
524288
65536
2
3
5
11
2000
524288
65536
2
3
5
12
2000
524288
65536
2
3
5
13
2000
524288
65536
2
3
5
14
2000
524288
65536
2
3
5
15
2000
524288
65536
2
3
5
16
2000
524288
65536
2
3
5
17
2000
524288
65536
3
4
5
18
2000
524288
65536
3
4
5
19
2000
524288
65536
3
4
5
20
2000
524288
65536
3
4
5
21
2000
524288
65536
3
4
5
22
2000
524288
65536
3
4
5
23
2000
524288
65536
2
4
5
24
2000
524288
65536
2
4
5
25
2000
524288
65536
2
4
5
26
2000
524288
65536
2
4
5
27
2000
524288
65536
2
4
5
28
2000
524288
65536
2
5
29
2000
524288
65536
2
5
30
2000
524288
65536
2
5
31
2000
524288
65536
2
5
32
2000
524288
65536
2
5
33
2000
524288
65536
2
5
34
2000
524288
65536
2
5
35
2000
524288
65536
2
5
36
2000
524288
65536
2
5
37
2000
524288
65536
2
5
38
2000
524288
65536
2
5
39
2000
524288
65536
2
5
40
2000
524288
65536
2
5
41
2000
524288
65536
2
5
42
2000
524288
65536
3
5
43
2000
524288
65536
3
5
44
2000
524288
65536
3
5
45
2000
524288
65536
3
5
46
2000
524288
65536
3
5
47
2000
524288
65536
3
5
48
2000
524288
65536
3
5
49
2000
524288
65536
3
5
50
2000
524288
65536
3
5
51
2000
524288
65536
4
5
52
2000
524288
65536
4
5
53
2000
524288
65536
4
5
54
2000
524288
65536
4
5
55
2000
524288
65536
4
5
56
2000
524288
65536
4
5
57
2000
524288
65536
4
5
58
2000
524288
65536
4
5
59
2000
524288
65536
4
5
60
2000
524288
65536
4
5
61
2000
524288
65536
4
5
62
2000
524288
65536
4
5
63
2000
524288
65536
4
5
64
2000
524288
65536
4
5
65
2000
524288
65536
4
5
66
2000
524288
65536
4
5
67
2000
524288
65536
5
68
2000
524288
65536
5
69
2000
524288
65536
5
70
2000
524288
65536
5
71
2000
524288
65536
5
72
2000
524288
65536
5
73
2000
524288
65536
5
74
2000
524288
65536
5
75
2000
524288
65536
5
76
2000
524288
65536
5
77
2000
524288
65536
5
78
2000
524288
65536
5
79
2000
524288
65536
5
80
2000
524288
65536
5
81
2000
524288
65536
5
82
2000
524288
65536
5
83
2000
524288
65536
5
84
2000
524288
65536
5
85
2000
524288
65536
5
86
2000
524288
65536
5
87
2000
524288
65536
5
88
2000
524288
65536
5
89
2000
524288
65536
5
90
2000
524288
65536
5
91
2000
524288
65536
5
92
2000
524288
65536
5
93
2000
524288
65536
5
94
2000
524288
65536
5
95
2000
524288
65536
5
Submit
Back to Top