Submission #71307534


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#define debug(arg) cout << "[" << #arg << "]: " << arg << endl
#else
#define debug(arg) 42
#endif

using llu = unsigned long long;
using ll = long long;

#define vec vector
#define pb push_back
#define all(n) begin(n), end(n)

void solv() {
	int n; ll h; cin >> n >> h;
	ll L = h, R = h;
	ll T = 0;
	vec<tuple<ll, ll, ll>> lr(n);
	for (auto &[t, l, r] : lr) cin >> t >> l >> r;
	for (auto &[t, l, r] : lr) {
		ll dt = t - T;
		L -= dt, R += dt;
		L = max(L, 0ll);
		R = min(R, r);
		L = max(L, l);
		if (L > R) return void(cout << "No\n");
		T = t;
	}
	cout << "Yes\n";
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	cin >> t;
	while (t--) solv();
	return 0;
}

Submission Info

Submission Time
Task C - Flapping Takahashi
User fisher199
Language C++23 (Clang 21.1.0)
Score 300
Code Size 794 Byte
Status AC
Exec Time 178 ms
Memory 5296 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 29
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_sample_00.txt AC 2 ms 2932 KiB
01_small_00.txt AC 178 ms 2932 KiB
01_small_01.txt AC 149 ms 2964 KiB
01_small_02.txt AC 139 ms 3012 KiB
01_small_03.txt AC 130 ms 2964 KiB
01_small_04.txt AC 124 ms 2884 KiB
01_small_05.txt AC 122 ms 3000 KiB
01_small_06.txt AC 118 ms 2964 KiB
01_small_07.txt AC 117 ms 2932 KiB
02_random_00.txt AC 93 ms 4748 KiB
02_random_01.txt AC 116 ms 5128 KiB
02_random_02.txt AC 118 ms 5116 KiB
02_random_03.txt AC 104 ms 4876 KiB
02_random_04.txt AC 117 ms 5072 KiB
02_random_05.txt AC 118 ms 5116 KiB
02_random_06.txt AC 94 ms 4752 KiB
02_random_07.txt AC 118 ms 5232 KiB
02_random_08.txt AC 118 ms 5136 KiB
02_random_09.txt AC 62 ms 4088 KiB
02_random_10.txt AC 118 ms 5132 KiB
02_random_11.txt AC 117 ms 5296 KiB
02_random_12.txt AC 119 ms 5292 KiB
02_random_13.txt AC 118 ms 5116 KiB
02_random_14.txt AC 118 ms 5232 KiB
02_random_15.txt AC 117 ms 5132 KiB
02_random_16.txt AC 116 ms 5112 KiB
02_random_17.txt AC 117 ms 5136 KiB
02_random_18.txt AC 117 ms 5128 KiB
02_random_19.txt AC 117 ms 5136 KiB