답안 #952357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
952357 2024-03-23T15:42:18 Z vjudge306 Fuel Station (NOI20_fuelstation) C++17
0 / 100
98 ms 12272 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.b>>i.c, 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)) {
        int f=min(d,ar[0].a), x=f; int 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=ar[i].c;
        }
        cout<<s;
    }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 98 ms 12272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 3 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 3 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -