Submission #22099338


Source Code Expand

def main():
    n = int(input())
    works = [tuple(map(int, input().split())) for _ in range(n)]
    works.sort(key=lambda x: x[0])

    dp = [0 for _ in range(5010)]
    for d, c, s in works:
        for i in range(d, c - 1, -1):
            dp[i] = max(dp[i], dp[i - c] + s)

    print(max(dp))


if __name__ == "__main__":
    main()

Submission Info

Submission Time
Task 011 - Gravy Jobs(★6)
User riantkb
Language Python (3.8.2)
Score 4
Code Size 338 Byte
Status TLE
Exec Time 2206 ms
Memory 9996 KiB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 2 / 2 2 / 2 0 / 2
Status
AC × 5
AC × 7
AC × 16
AC × 23
TLE × 2
Set Name Test Cases
Sample 00_sample_0_123.txt, 00_sample_1_123.txt, 00_sample_2_123.txt, 00_sample_3__23.txt, 00_sample_4___3.txt
Subtask1 00_sample_0_123.txt, 00_sample_1_123.txt, 00_sample_2_123.txt, 01_random_0_123.txt, 01_random_1_123.txt, 01_random_2_123.txt, 01_random_3_123.txt
Subtask2 00_sample_0_123.txt, 00_sample_1_123.txt, 00_sample_2_123.txt, 00_sample_3__23.txt, 01_random_0_123.txt, 01_random_1_123.txt, 01_random_2_123.txt, 01_random_3_123.txt, 02_random_0__23.txt, 02_random_1__23.txt, 02_random_2__23.txt, 02_random_3__23.txt, 03_maxima_0__23.txt, 03_maxima_1__23.txt, 03_maxima_2__23.txt, 03_maxima_3__23.txt
Subtask3 00_sample_0_123.txt, 00_sample_1_123.txt, 00_sample_2_123.txt, 00_sample_3__23.txt, 00_sample_4___3.txt, 01_random_0_123.txt, 01_random_1_123.txt, 01_random_2_123.txt, 01_random_3_123.txt, 02_random_0__23.txt, 02_random_1__23.txt, 02_random_2__23.txt, 02_random_3__23.txt, 03_maxima_0__23.txt, 03_maxima_1__23.txt, 03_maxima_2__23.txt, 03_maxima_3__23.txt, 04_random_0__3.txt, 04_random_1__3.txt, 04_random_2__3.txt, 04_random_3__3.txt, 05_maxima_0__3.txt, 05_maxima_1__3.txt, 05_maxima_2__3.txt, 05_maxima_3__3.txt
Case Name Status Exec Time Memory
00_sample_0_123.txt AC 19 ms 8924 KiB
00_sample_1_123.txt AC 21 ms 8920 KiB
00_sample_2_123.txt AC 27 ms 9140 KiB
00_sample_3__23.txt AC 31 ms 9052 KiB
00_sample_4___3.txt AC 41 ms 9216 KiB
01_random_0_123.txt AC 20 ms 9244 KiB
01_random_1_123.txt AC 25 ms 9096 KiB
01_random_2_123.txt AC 19 ms 8948 KiB
01_random_3_123.txt AC 20 ms 8928 KiB
02_random_0__23.txt AC 26 ms 9192 KiB
02_random_1__23.txt AC 27 ms 9024 KiB
02_random_2__23.txt AC 22 ms 9056 KiB
02_random_3__23.txt AC 28 ms 8968 KiB
03_maxima_0__23.txt AC 23 ms 9316 KiB
03_maxima_1__23.txt AC 22 ms 9196 KiB
03_maxima_2__23.txt AC 36 ms 9192 KiB
03_maxima_3__23.txt AC 46 ms 9052 KiB
04_random_0__3.txt AC 724 ms 9696 KiB
04_random_1__3.txt AC 29 ms 9324 KiB
04_random_2__3.txt AC 101 ms 9324 KiB
04_random_3__3.txt AC 111 ms 9176 KiB
05_maxima_0__3.txt AC 1012 ms 9984 KiB
05_maxima_1__3.txt AC 34 ms 9832 KiB
05_maxima_2__3.txt TLE 2206 ms 9876 KiB
05_maxima_3__3.txt TLE 2206 ms 9996 KiB