Submission #952368

# Submission time Handle Problem Language Result Execution time Memory
952368 2024-03-23T15:58:00 Z vjudge306 Fuel Station (NOI20_fuelstation) C++17
20 / 100
106 ms 4180 KB
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nn "\n"
#define x_x ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define intt int _; cin >> _; while (_--)
#define emp push_back
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ld long double
#define A first
#define B second
//#define int long long
typedef long long ll;
const ld eps = 1e-27;
// diff between decimals 0.000000001 mt19937 mt(time(nullptr));
struct in {
int a; int b; int c;
};
bool ss(in a, in b) {
return a.a<b.a;
}
int main() {

    x_x
    int n,d; cin>>n>>d; in ar[n]; int mn=INT_MAX;
    for (auto&i:ar) cin>>i.a>>i.c>>i.b, mn=min(mn,i.b);
    sort(ar, ar+n,ss);
    if (n==1) {
        int x=d; int y=max(ar[0].a, d-ar[0].c); if (y>ar[0].b) y=d;
        cout<<min(x,y);
    }
    else if(mn==(1e9)) {
        ll f=0, x=0; ll s=f;
        for (int i=0; i<n&&ar[i].a<d; i++) {
            f-=(ar[i].a-x), x=ar[i].a;
            if(f<0)s+=(f*-1),f=0;
             f+=ar[i].c;
        }
        f-=(d-x); if(f<0) s+=(f*-1);
        cout<<s;
    }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 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 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 3932 KB Output is correct
2 Correct 91 ms 3932 KB Output is correct
3 Correct 88 ms 3948 KB Output is correct
4 Correct 83 ms 3932 KB Output is correct
5 Correct 86 ms 3932 KB Output is correct
6 Correct 97 ms 3952 KB Output is correct
7 Correct 86 ms 3948 KB Output is correct
8 Correct 83 ms 3940 KB Output is correct
9 Correct 94 ms 3952 KB Output is correct
10 Correct 82 ms 3948 KB Output is correct
11 Correct 95 ms 3932 KB Output is correct
12 Correct 83 ms 3932 KB Output is correct
13 Correct 92 ms 3932 KB Output is correct
14 Correct 91 ms 3928 KB Output is correct
15 Correct 91 ms 3952 KB Output is correct
16 Correct 95 ms 3948 KB Output is correct
17 Correct 86 ms 4180 KB Output is correct
18 Correct 99 ms 3952 KB Output is correct
19 Correct 82 ms 3928 KB Output is correct
20 Correct 95 ms 4176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 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 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Incorrect 0 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 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 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Incorrect 2 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 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 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 106 ms 3932 KB Output is correct
17 Correct 91 ms 3932 KB Output is correct
18 Correct 88 ms 3948 KB Output is correct
19 Correct 83 ms 3932 KB Output is correct
20 Correct 86 ms 3932 KB Output is correct
21 Correct 97 ms 3952 KB Output is correct
22 Correct 86 ms 3948 KB Output is correct
23 Correct 83 ms 3940 KB Output is correct
24 Correct 94 ms 3952 KB Output is correct
25 Correct 82 ms 3948 KB Output is correct
26 Correct 95 ms 3932 KB Output is correct
27 Correct 83 ms 3932 KB Output is correct
28 Correct 92 ms 3932 KB Output is correct
29 Correct 91 ms 3928 KB Output is correct
30 Correct 91 ms 3952 KB Output is correct
31 Correct 95 ms 3948 KB Output is correct
32 Correct 86 ms 4180 KB Output is correct
33 Correct 99 ms 3952 KB Output is correct
34 Correct 82 ms 3928 KB Output is correct
35 Correct 95 ms 4176 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Incorrect 2 ms 348 KB Output isn't correct
38 Halted 0 ms 0 KB -