Submission #951952

# Submission time Handle Problem Language Result Execution time Memory
951952 2024-03-23T02:39:17 Z Mohamed_Kachef06 Fuel Station (NOI20_fuelstation) C++17
54 / 100
3000 ms 18192 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 = 0;
        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 , -mn); 
    }
    cout << ans; 
}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    doWork(); 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 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 0 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 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3075 ms 17652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 217 ms 884 KB Output is correct
3 Correct 214 ms 860 KB Output is correct
4 Correct 215 ms 856 KB Output is correct
5 Correct 223 ms 1112 KB Output is correct
6 Correct 212 ms 860 KB Output is correct
7 Correct 212 ms 916 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 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 211 ms 860 KB Output is correct
15 Correct 215 ms 860 KB Output is correct
16 Correct 219 ms 860 KB Output is correct
17 Correct 218 ms 860 KB Output is correct
18 Correct 214 ms 860 KB Output is correct
19 Correct 215 ms 860 KB Output is correct
20 Correct 103 ms 916 KB Output is correct
21 Correct 96 ms 856 KB Output is correct
22 Correct 217 ms 860 KB Output is correct
23 Correct 219 ms 860 KB Output is correct
24 Correct 211 ms 920 KB Output is correct
25 Correct 213 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 217 ms 884 KB Output is correct
3 Correct 214 ms 860 KB Output is correct
4 Correct 215 ms 856 KB Output is correct
5 Correct 223 ms 1112 KB Output is correct
6 Correct 212 ms 860 KB Output is correct
7 Correct 212 ms 916 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 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 211 ms 860 KB Output is correct
15 Correct 215 ms 860 KB Output is correct
16 Correct 219 ms 860 KB Output is correct
17 Correct 218 ms 860 KB Output is correct
18 Correct 214 ms 860 KB Output is correct
19 Correct 215 ms 860 KB Output is correct
20 Correct 103 ms 916 KB Output is correct
21 Correct 96 ms 856 KB Output is correct
22 Correct 217 ms 860 KB Output is correct
23 Correct 219 ms 860 KB Output is correct
24 Correct 211 ms 920 KB Output is correct
25 Correct 213 ms 856 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Execution timed out 3087 ms 18192 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 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 0 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 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 360 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 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 0 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 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 217 ms 884 KB Output is correct
18 Correct 214 ms 860 KB Output is correct
19 Correct 215 ms 856 KB Output is correct
20 Correct 223 ms 1112 KB Output is correct
21 Correct 212 ms 860 KB Output is correct
22 Correct 212 ms 916 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 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 211 ms 860 KB Output is correct
30 Correct 215 ms 860 KB Output is correct
31 Correct 219 ms 860 KB Output is correct
32 Correct 218 ms 860 KB Output is correct
33 Correct 214 ms 860 KB Output is correct
34 Correct 215 ms 860 KB Output is correct
35 Correct 103 ms 916 KB Output is correct
36 Correct 96 ms 856 KB Output is correct
37 Correct 217 ms 860 KB Output is correct
38 Correct 219 ms 860 KB Output is correct
39 Correct 211 ms 920 KB Output is correct
40 Correct 213 ms 856 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 222 ms 1048 KB Output is correct
43 Correct 213 ms 920 KB Output is correct
44 Correct 221 ms 916 KB Output is correct
45 Correct 211 ms 860 KB Output is correct
46 Correct 244 ms 856 KB Output is correct
47 Correct 232 ms 860 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 216 ms 860 KB Output is correct
55 Correct 223 ms 864 KB Output is correct
56 Correct 218 ms 860 KB Output is correct
57 Correct 221 ms 860 KB Output is correct
58 Correct 214 ms 860 KB Output is correct
59 Correct 219 ms 860 KB Output is correct
60 Correct 98 ms 860 KB Output is correct
61 Correct 99 ms 860 KB Output is correct
62 Correct 213 ms 856 KB Output is correct
63 Correct 220 ms 860 KB Output is correct
64 Correct 216 ms 860 KB Output is correct
65 Correct 218 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 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 0 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 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Execution timed out 3075 ms 17652 KB Time limit exceeded
17 Halted 0 ms 0 KB -