Toggle navigation
Bulletin
Problems
Submissions
Contests
Discuss
About
Rank
Sign in
Sign up
×
Close
2024 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2023 全國模擬賽題目上線啦 !!!!!
題目在
這裡
~
2405 . 吃午餐
Submit
Status
Discussion / Solution
Ranklist
Back to Problems List
TopCoder
餘切
$\Huge\text{pooh is 8}$
User's AC Ratio
66.7% (
2/3
)
Submission's AC Ratio
50.0% (
2
/
4
)
Tags
Show solution-related tags
pre-nhspc-2023
全國模擬賽
Description
題目 PDF 檔在這裡
Input Format
Output Format
Sample Input 1
copy
6
3 2 1 4 1 3
1 3 2 1 4 2
Sample Output 1
copy
6
Sample Input 2
copy
10
3 9 10 39 77 98 73 87 28 23
42 97 87 74 28 34 8 6 65 55
Sample Output 2
copy
132
Sample Input 3
copy
10
46 99 6 99 38 43 34 36 15 94
53 47 54 32 53 2 2 84 81 65
Sample Output 3
copy
159
Hints
Problem Source
112 學年度全國資訊學科能力競賽模擬賽
Subtasks
No.
Testdata Range
Constraints
Score
1
0~2
範例測資
0
2
0~32
$N \leq 20$
15
3
0~72
$N \leq 2000$
16
4
0~132
無額外限制
69
Testdata and Limits
No.
Time Limit (ms)
Memory Limit (VSS, KiB)
Output Limit (KiB)
Subtasks
0
2000
524288
65536
1
2
3
4
1
2000
524288
65536
1
2
3
4
2
2000
524288
65536
1
2
3
4
3
2000
524288
65536
2
3
4
4
2000
524288
65536
2
3
4
5
2000
524288
65536
2
3
4
6
2000
524288
65536
2
3
4
7
2000
524288
65536
2
3
4
8
2000
524288
65536
2
3
4
9
2000
524288
65536
2
3
4
10
2000
524288
65536
2
3
4
11
2000
524288
65536
2
3
4
12
2000
524288
65536
2
3
4
13
2000
524288
65536
2
3
4
14
2000
524288
65536
2
3
4
15
2000
524288
65536
2
3
4
16
2000
524288
65536
2
3
4
17
2000
524288
65536
2
3
4
18
2000
524288
65536
2
3
4
19
2000
524288
65536
2
3
4
20
2000
524288
65536
2
3
4
21
2000
524288
65536
2
3
4
22
2000
524288
65536
2
3
4
23
2000
524288
65536
2
3
4
24
2000
524288
65536
2
3
4
25
2000
524288
65536
2
3
4
26
2000
524288
65536
2
3
4
27
2000
524288
65536
2
3
4
28
2000
524288
65536
2
3
4
29
2000
524288
65536
2
3
4
30
2000
524288
65536
2
3
4
31
2000
524288
65536
2
3
4
32
2000
524288
65536
2
3
4
33
2000
524288
65536
3
4
34
2000
524288
65536
3
4
35
2000
524288
65536
3
4
36
2000
524288
65536
3
4
37
2000
524288
65536
3
4
38
2000
524288
65536
3
4
39
2000
524288
65536
3
4
40
2000
524288
65536
3
4
41
2000
524288
65536
3
4
42
2000
524288
65536
3
4
43
2000
524288
65536
3
4
44
2000
524288
65536
3
4
45
2000
524288
65536
3
4
46
2000
524288
65536
3
4
47
2000
524288
65536
3
4
48
2000
524288
65536
3
4
49
2000
524288
65536
3
4
50
2000
524288
65536
3
4
51
2000
524288
65536
3
4
52
2000
524288
65536
3
4
53
2000
524288
65536
3
4
54
2000
524288
65536
3
4
55
2000
524288
65536
3
4
56
2000
524288
65536
3
4
57
2000
524288
65536
3
4
58
2000
524288
65536
3
4
59
2000
524288
65536
3
4
60
2000
524288
65536
3
4
61
2000
524288
65536
3
4
62
2000
524288
65536
3
4
63
2000
524288
65536
3
4
64
2000
524288
65536
3
4
65
2000
524288
65536
3
4
66
2000
524288
65536
3
4
67
2000
524288
65536
3
4
68
2000
524288
65536
3
4
69
2000
524288
65536
3
4
70
2000
524288
65536
3
4
71
2000
524288
65536
3
4
72
2000
524288
65536
3
4
73
2000
524288
65536
4
74
2000
524288
65536
4
75
2000
524288
65536
4
76
2000
524288
65536
4
77
2000
524288
65536
4
78
2000
524288
65536
4
79
2000
524288
65536
4
80
2000
524288
65536
4
81
2000
524288
65536
4
82
2000
524288
65536
4
83
2000
524288
65536
4
84
2000
524288
65536
4
85
2000
524288
65536
4
86
2000
524288
65536
4
87
2000
524288
65536
4
88
2000
524288
65536
4
89
2000
524288
65536
4
90
2000
524288
65536
4
91
2000
524288
65536
4
92
2000
524288
65536
4
93
2000
524288
65536
4
94
2000
524288
65536
4
95
2000
524288
65536
4
96
2000
524288
65536
4
97
2000
524288
65536
4
98
2000
524288
65536
4
99
2000
524288
65536
4
100
2000
524288
65536
4
101
2000
524288
65536
4
102
2000
524288
65536
4
103
2000
524288
65536
4
104
2000
524288
65536
4
105
2000
524288
65536
4
106
2000
524288
65536
4
107
2000
524288
65536
4
108
2000
524288
65536
4
109
2000
524288
65536
4
110
2000
524288
65536
4
111
2000
524288
65536
4
112
2000
524288
65536
4
113
2000
524288
65536
4
114
2000
524288
65536
4
115
2000
524288
65536
4
116
2000
524288
65536
4
117
2000
524288
65536
4
118
2000
524288
65536
4
119
2000
524288
65536
4
120
2000
524288
65536
4
121
2000
524288
65536
4
122
2000
524288
65536
4
123
2000
524288
65536
4
124
2000
524288
65536
4
125
2000
524288
65536
4
126
2000
524288
65536
4
127
2000
524288
65536
4
128
2000
524288
65536
4
129
2000
524288
65536
4
130
2000
524288
65536
4
131
2000
524288
65536
4
132
2000
524288
65536
4
Submit
Back to Top