TopCoder

Caido
主唱太拼命了

User's AC Ratio

93.3% (14/15)

Submission's AC Ratio

34.9% (22/63)

Tags

Description

Input Format

Output Format

Sample Input 1

4 7
1 3 424849053 592732474
1 1 787225144 158123046
2 4 3
3 4 534558786
2 2 4
3 2 806668402
3 3 679670154

Sample Output 1

592732474
592732474
-1

Sample Input 2

10 13
1 7 205588596 580018058
2 5 7
1 6 511038935 266614169
1 6 486422924 865076365
1 10 445734405 877372041
3 10 843207541
2 4 9
2 7 8
1 1 708876592 402376498
2 9 5
2 2 6
2 6 5
3 6 323976805

Sample Output 2

877372041
-1

Hints

Problem Source

YTP 2024 高中組程式挑戰營 p11

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 2~5 $N = 1$ 6
3 0~15 $N \leq 200$ 6
4 0~31 無額外限制 8

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 1048576 65536 1 3 4
1 1000 1048576 65536 1 3 4
2 1000 1048576 65536 2 3 4
3 1000 1048576 65536 2 3 4
4 1000 1048576 65536 2 3 4
5 1000 1048576 65536 2 3 4
6 1000 1048576 65536 3 4
7 1000 1048576 65536 3 4
8 1000 1048576 65536 3 4
9 1000 1048576 65536 3 4
10 1000 1048576 65536 3 4
11 1000 1048576 65536 3 4
12 1000 1048576 65536 3 4
13 1000 1048576 65536 3 4
14 1000 1048576 65536 3 4
15 1000 1048576 65536 3 4
16 1000 1048576 65536 4
17 1000 1048576 65536 4
18 1000 1048576 65536 4
19 1000 1048576 65536 4
20 1000 1048576 65536 4
21 1000 1048576 65536 4
22 1000 1048576 65536 4
23 1000 1048576 65536 4
24 1000 1048576 65536 4
25 1000 1048576 65536 4
26 1000 1048576 65536 4
27 1000 1048576 65536 4
28 1000 1048576 65536 4
29 1000 1048576 65536 4
30 1000 1048576 65536 4
31 1000 1048576 65536 4