Submission #546962

# Submission time Handle Problem Language Result Execution time Memory
546962 2022-04-09T05:02:42 Z socpite Fuel Station (NOI20_fuelstation) C++14
24 / 100
3000 ms 7108 KB
#include<bits/stdc++.h>
using namespace std;

#define f first
#define s second

typedef long long ll;
typedef pair<int, int> pii;

const int maxn = 3e5+5;

int n, D;
int ans, crr;
pair<int, pii> fuel[maxn];
int sB[maxn];

int main(){
    cin >> n >> D;
    fuel[0].f = 0;
    for(int i = 1; i <= n; i++){
        cin >> fuel[i].f >> fuel[i].s.f >> fuel[i].s.s;
        sB[i] = fuel[i].s.s;
    }
    sort(sB+1, sB+n+1);
    sort(fuel+1, fuel+n+1);
    for(int i = 1; i <= n; i++){
        int crr = 0, ff = 0, gg = 1;
        for(int j = 1; j <= n; j++){
            crr-=fuel[j].f-fuel[j-1].f;
            if(crr < 0){
                ff-=crr;
                crr = 0;
            }
            if(fuel[j].s.s >= sB[i])crr+=fuel[j].s.f;
            if(ff > sB[i]){
                gg = 0;
                break;
            }
        }
        crr -= D-fuel[n].f;
        if(crr < 0){
            ff-=crr;
            crr = 0;
        }
        if(ff > sB[i])gg=0;
        if(gg){
            cout << ff;
            return 0;
        }
    }
    cout << D;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 587 ms 5236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 9 ms 596 KB Output is correct
3 Correct 9 ms 600 KB Output is correct
4 Correct 9 ms 596 KB Output is correct
5 Correct 8 ms 576 KB Output is correct
6 Correct 9 ms 608 KB Output is correct
7 Correct 9 ms 580 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 300 KB Output is correct
14 Correct 9 ms 564 KB Output is correct
15 Correct 9 ms 596 KB Output is correct
16 Correct 9 ms 596 KB Output is correct
17 Correct 8 ms 596 KB Output is correct
18 Correct 9 ms 560 KB Output is correct
19 Correct 8 ms 596 KB Output is correct
20 Correct 10 ms 652 KB Output is correct
21 Correct 9 ms 556 KB Output is correct
22 Correct 9 ms 572 KB Output is correct
23 Correct 9 ms 596 KB Output is correct
24 Correct 9 ms 520 KB Output is correct
25 Correct 9 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 9 ms 596 KB Output is correct
3 Correct 9 ms 600 KB Output is correct
4 Correct 9 ms 596 KB Output is correct
5 Correct 8 ms 576 KB Output is correct
6 Correct 9 ms 608 KB Output is correct
7 Correct 9 ms 580 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 300 KB Output is correct
14 Correct 9 ms 564 KB Output is correct
15 Correct 9 ms 596 KB Output is correct
16 Correct 9 ms 596 KB Output is correct
17 Correct 8 ms 596 KB Output is correct
18 Correct 9 ms 560 KB Output is correct
19 Correct 8 ms 596 KB Output is correct
20 Correct 10 ms 652 KB Output is correct
21 Correct 9 ms 556 KB Output is correct
22 Correct 9 ms 572 KB Output is correct
23 Correct 9 ms 596 KB Output is correct
24 Correct 9 ms 520 KB Output is correct
25 Correct 9 ms 596 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 252 ms 7016 KB Output is correct
28 Correct 240 ms 7108 KB Output is correct
29 Correct 235 ms 6920 KB Output is correct
30 Correct 237 ms 6940 KB Output is correct
31 Correct 249 ms 7000 KB Output is correct
32 Correct 247 ms 7100 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 1 ms 308 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 308 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 259 ms 6952 KB Output is correct
40 Correct 250 ms 7092 KB Output is correct
41 Correct 252 ms 6980 KB Output is correct
42 Correct 256 ms 7024 KB Output is correct
43 Correct 247 ms 6864 KB Output is correct
44 Execution timed out 3025 ms 6952 KB Time limit exceeded
45 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 308 KB Output is correct
21 Incorrect 0 ms 212 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 9 ms 596 KB Output is correct
18 Correct 9 ms 600 KB Output is correct
19 Correct 9 ms 596 KB Output is correct
20 Correct 8 ms 576 KB Output is correct
21 Correct 9 ms 608 KB Output is correct
22 Correct 9 ms 580 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 300 KB Output is correct
29 Correct 9 ms 564 KB Output is correct
30 Correct 9 ms 596 KB Output is correct
31 Correct 9 ms 596 KB Output is correct
32 Correct 8 ms 596 KB Output is correct
33 Correct 9 ms 560 KB Output is correct
34 Correct 8 ms 596 KB Output is correct
35 Correct 10 ms 652 KB Output is correct
36 Correct 9 ms 556 KB Output is correct
37 Correct 9 ms 572 KB Output is correct
38 Correct 9 ms 596 KB Output is correct
39 Correct 9 ms 520 KB Output is correct
40 Correct 9 ms 596 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Incorrect 53 ms 596 KB Output isn't correct
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Incorrect 587 ms 5236 KB Output isn't correct
17 Halted 0 ms 0 KB -