提出 #71305823


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf = 2000000000000000000;

void solve(){
    int n,h;cin>>n>>h;
    int t[n],l[n],r[n];
    for(int i=0;i<n;i++){
        cin>>t[i]>>l[i]>>r[i];
    }
    int time=0,L=h,R=h;
    for(int i=0;i<n;i++){
        int henka = t[i]-time;
        if(L-henka > r[i] || R+henka < l[i]){
            cout<<"No\n";return;
        }
        R=min(R+henka , r[i]);
        L=max(L-henka , l[i]);
        time = t[i];
    }
    cout<<"Yes\n";
}

signed main(){
    int q;cin>>q;
    while(q--){
        solve();
    }
}

提出情報

提出日時
問題 C - Flapping Takahashi
ユーザ Sabakanmelm
言語 C++23 (GCC 15.2.0)
得点 300
コード長 612 Byte
結果 AC
実行時間 142 ms
メモリ 6068 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 3532 KiB
01_small_00.txt AC 142 ms 3588 KiB
01_small_01.txt AC 108 ms 3536 KiB
01_small_02.txt AC 96 ms 3344 KiB
01_small_03.txt AC 86 ms 3368 KiB
01_small_04.txt AC 79 ms 3548 KiB
01_small_05.txt AC 76 ms 3588 KiB
01_small_06.txt AC 74 ms 3468 KiB
01_small_07.txt AC 72 ms 3620 KiB
02_random_00.txt AC 58 ms 5556 KiB
02_random_01.txt AC 72 ms 6052 KiB
02_random_02.txt AC 73 ms 5800 KiB
02_random_03.txt AC 64 ms 5584 KiB
02_random_04.txt AC 74 ms 5848 KiB
02_random_05.txt AC 73 ms 5800 KiB
02_random_06.txt AC 58 ms 5444 KiB
02_random_07.txt AC 73 ms 6020 KiB
02_random_08.txt AC 74 ms 5800 KiB
02_random_09.txt AC 39 ms 4828 KiB
02_random_10.txt AC 74 ms 5836 KiB
02_random_11.txt AC 72 ms 6052 KiB
02_random_12.txt AC 73 ms 5848 KiB
02_random_13.txt AC 73 ms 6068 KiB
02_random_14.txt AC 74 ms 5800 KiB
02_random_15.txt AC 74 ms 6052 KiB
02_random_16.txt AC 73 ms 6068 KiB
02_random_17.txt AC 73 ms 6020 KiB
02_random_18.txt AC 73 ms 5900 KiB
02_random_19.txt AC 73 ms 6052 KiB