답안 #951951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951951 2024-03-23T02:38:41 Z Mohamed_Kachef06 Fuel Station (NOI20_fuelstation) C++17
54 / 100
3000 ms 25836 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

void doWork(){
    int N , D;
    cin >> N >> D;
    vector<array<int, 3>> v;
    vector<int> B; 
    for (int i = 0 ; i < N ; i++){
        int x , a , b ;
        cin >> x >> a >> b;
        v.push_back({x , a , b});
        B.push_back(b); 
    }
    B.push_back(1e18);
    v.push_back({D , 0 , 0}); 
    sort(v.begin() , v.end()); 
    sort(B.begin() , B.end());     
    int ans = 1e18;
    for (int F = 0 ; F <= N ; F++){
        int mn = 1e18;
        int sum = 0; 
        for (int i = 0 ; i <= N ; i++){
            mn = min(mn , sum - v[i][0]); 
            if (B[F] <= v[i][2]) sum += v[i][1]; 
        }
        if (-mn <= B[F]) ans = min(ans , max(0ll , -mn)); 
    }
    cout << ans; 
}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    doWork(); 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3018 ms 25836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 203 ms 1040 KB Output is correct
3 Correct 208 ms 1112 KB Output is correct
4 Correct 202 ms 1112 KB Output is correct
5 Correct 202 ms 1116 KB Output is correct
6 Correct 202 ms 1112 KB Output is correct
7 Correct 202 ms 1112 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 203 ms 1116 KB Output is correct
15 Correct 201 ms 1116 KB Output is correct
16 Correct 200 ms 1116 KB Output is correct
17 Correct 201 ms 1312 KB Output is correct
18 Correct 202 ms 1164 KB Output is correct
19 Correct 206 ms 1112 KB Output is correct
20 Correct 95 ms 1116 KB Output is correct
21 Correct 96 ms 1112 KB Output is correct
22 Correct 203 ms 1116 KB Output is correct
23 Correct 204 ms 1116 KB Output is correct
24 Correct 203 ms 1112 KB Output is correct
25 Correct 202 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 203 ms 1040 KB Output is correct
3 Correct 208 ms 1112 KB Output is correct
4 Correct 202 ms 1112 KB Output is correct
5 Correct 202 ms 1116 KB Output is correct
6 Correct 202 ms 1112 KB Output is correct
7 Correct 202 ms 1112 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 203 ms 1116 KB Output is correct
15 Correct 201 ms 1116 KB Output is correct
16 Correct 200 ms 1116 KB Output is correct
17 Correct 201 ms 1312 KB Output is correct
18 Correct 202 ms 1164 KB Output is correct
19 Correct 206 ms 1112 KB Output is correct
20 Correct 95 ms 1116 KB Output is correct
21 Correct 96 ms 1112 KB Output is correct
22 Correct 203 ms 1116 KB Output is correct
23 Correct 204 ms 1116 KB Output is correct
24 Correct 203 ms 1112 KB Output is correct
25 Correct 202 ms 1116 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Execution timed out 3075 ms 21396 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 600 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 456 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 596 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 600 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 203 ms 1040 KB Output is correct
18 Correct 208 ms 1112 KB Output is correct
19 Correct 202 ms 1112 KB Output is correct
20 Correct 202 ms 1116 KB Output is correct
21 Correct 202 ms 1112 KB Output is correct
22 Correct 202 ms 1112 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 203 ms 1116 KB Output is correct
30 Correct 201 ms 1116 KB Output is correct
31 Correct 200 ms 1116 KB Output is correct
32 Correct 201 ms 1312 KB Output is correct
33 Correct 202 ms 1164 KB Output is correct
34 Correct 206 ms 1112 KB Output is correct
35 Correct 95 ms 1116 KB Output is correct
36 Correct 96 ms 1112 KB Output is correct
37 Correct 203 ms 1116 KB Output is correct
38 Correct 204 ms 1116 KB Output is correct
39 Correct 203 ms 1112 KB Output is correct
40 Correct 202 ms 1116 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 205 ms 1368 KB Output is correct
43 Correct 201 ms 1116 KB Output is correct
44 Correct 206 ms 1176 KB Output is correct
45 Correct 203 ms 1176 KB Output is correct
46 Correct 203 ms 1176 KB Output is correct
47 Correct 208 ms 1320 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 344 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 206 ms 1176 KB Output is correct
55 Correct 206 ms 1176 KB Output is correct
56 Correct 203 ms 1172 KB Output is correct
57 Correct 201 ms 1172 KB Output is correct
58 Correct 203 ms 1176 KB Output is correct
59 Correct 205 ms 1316 KB Output is correct
60 Correct 96 ms 1176 KB Output is correct
61 Correct 100 ms 1184 KB Output is correct
62 Correct 205 ms 1172 KB Output is correct
63 Correct 209 ms 1116 KB Output is correct
64 Correct 210 ms 1172 KB Output is correct
65 Correct 205 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 600 KB Output is correct
16 Execution timed out 3018 ms 25836 KB Time limit exceeded
17 Halted 0 ms 0 KB -