답안 #952367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
952367 2024-03-23T15:57:18 Z vjudge306 Fuel Station (NOI20_fuelstation) C++17
20 / 100
102 ms 12904 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  {
        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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 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 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
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 3932 KB Output is correct
2 Correct 93 ms 12116 KB Output is correct
3 Correct 91 ms 12264 KB Output is correct
4 Correct 85 ms 12356 KB Output is correct
5 Correct 87 ms 12764 KB Output is correct
6 Correct 94 ms 11612 KB Output is correct
7 Correct 88 ms 11600 KB Output is correct
8 Correct 85 ms 12116 KB Output is correct
9 Correct 101 ms 12880 KB Output is correct
10 Correct 83 ms 11628 KB Output is correct
11 Correct 97 ms 11740 KB Output is correct
12 Correct 91 ms 12360 KB Output is correct
13 Correct 90 ms 11632 KB Output is correct
14 Correct 89 ms 12264 KB Output is correct
15 Correct 84 ms 12372 KB Output is correct
16 Correct 94 ms 12904 KB Output is correct
17 Correct 88 ms 12892 KB Output is correct
18 Correct 91 ms 12272 KB Output is correct
19 Correct 94 ms 12380 KB Output is correct
20 Correct 102 ms 12116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 676 KB Output is correct
5 Correct 4 ms 604 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 3 ms 604 KB Output is correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 676 KB Output is correct
5 Correct 4 ms 604 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 3 ms 604 KB Output is correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 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 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 1 ms 388 KB Output is correct
18 Incorrect 0 ms 456 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 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 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 344 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 3 ms 676 KB Output is correct
20 Correct 4 ms 604 KB Output is correct
21 Correct 3 ms 604 KB Output is correct
22 Correct 3 ms 604 KB Output is correct
23 Incorrect 0 ms 348 KB Output isn't correct
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 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 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 90 ms 3932 KB Output is correct
17 Correct 93 ms 12116 KB Output is correct
18 Correct 91 ms 12264 KB Output is correct
19 Correct 85 ms 12356 KB Output is correct
20 Correct 87 ms 12764 KB Output is correct
21 Correct 94 ms 11612 KB Output is correct
22 Correct 88 ms 11600 KB Output is correct
23 Correct 85 ms 12116 KB Output is correct
24 Correct 101 ms 12880 KB Output is correct
25 Correct 83 ms 11628 KB Output is correct
26 Correct 97 ms 11740 KB Output is correct
27 Correct 91 ms 12360 KB Output is correct
28 Correct 90 ms 11632 KB Output is correct
29 Correct 89 ms 12264 KB Output is correct
30 Correct 84 ms 12372 KB Output is correct
31 Correct 94 ms 12904 KB Output is correct
32 Correct 88 ms 12892 KB Output is correct
33 Correct 91 ms 12272 KB Output is correct
34 Correct 94 ms 12380 KB Output is correct
35 Correct 102 ms 12116 KB Output is correct
36 Correct 0 ms 344 KB Output is correct
37 Correct 2 ms 348 KB Output is correct
38 Correct 3 ms 604 KB Output is correct
39 Correct 3 ms 676 KB Output is correct
40 Correct 4 ms 604 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 3 ms 604 KB Output is correct
43 Incorrect 0 ms 348 KB Output isn't correct
44 Halted 0 ms 0 KB -