提出 #71308142


ソースコード 拡げる

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vmi = vector<mint>;
using vvmi = vector<vmi>;
using vvvmi = vector<vvmi>;
#define all(a) (a).begin(), (a).end()
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define drep(i, n) drep2(i, n, 0)

void solve(){
    int n; ll h; cin >> n >> h;
    ll low = h, high = h;
    ll time = 0;
    bool f = true;
    rep(i, n){
        ll t, l, u; cin >> t >> l >> u;
        ll ma = high + (t-time), mn = max((ll)0, low-(t-time));
        if(ma < l || mn > u){
            f = false;
        }
        high = min(u, ma);
        low = max(l, mn);
        time = t;
    }
    cout << (f ? "Yes" : "No") << endl;
}

int main(){

    int t; cin >> t;
    while(t--)solve();
    return 0;
}

提出情報

提出日時
問題 C - Flapping Takahashi
ユーザ applejam
言語 C++23 (GCC 15.2.0)
得点 300
コード長 1121 Byte
結果 AC
実行時間 156 ms
メモリ 3644 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 29
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3360 KiB
01_small_00.txt AC 156 ms 3360 KiB
01_small_01.txt AC 118 ms 3436 KiB
01_small_02.txt AC 105 ms 3616 KiB
01_small_03.txt AC 94 ms 3360 KiB
01_small_04.txt AC 87 ms 3536 KiB
01_small_05.txt AC 83 ms 3404 KiB
01_small_06.txt AC 80 ms 3548 KiB
01_small_07.txt AC 80 ms 3484 KiB
02_random_00.txt AC 62 ms 3548 KiB
02_random_01.txt AC 78 ms 3408 KiB
02_random_02.txt AC 79 ms 3492 KiB
02_random_03.txt AC 70 ms 3360 KiB
02_random_04.txt AC 79 ms 3644 KiB
02_random_05.txt AC 79 ms 3372 KiB
02_random_06.txt AC 63 ms 3372 KiB
02_random_07.txt AC 79 ms 3404 KiB
02_random_08.txt AC 79 ms 3548 KiB
02_random_09.txt AC 41 ms 3584 KiB
02_random_10.txt AC 79 ms 3360 KiB
02_random_11.txt AC 79 ms 3496 KiB
02_random_12.txt AC 79 ms 3372 KiB
02_random_13.txt AC 79 ms 3372 KiB
02_random_14.txt AC 78 ms 3372 KiB
02_random_15.txt AC 79 ms 3408 KiB
02_random_16.txt AC 79 ms 3496 KiB
02_random_17.txt AC 79 ms 3500 KiB
02_random_18.txt AC 80 ms 3408 KiB
02_random_19.txt AC 78 ms 3644 KiB