Submission #71307985


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
int t, n, h;
struct node {
	int tmm, l, r;
	bool operator <(node a) {
		return tmm < a.tmm;
	}
} a[100005];
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --) {
		cin >> n >> h;
		for(int i = 1; i <= n; i ++) cin >> a[i].tmm >> a[i].l >> a[i].r;
		sort(a + 1, a + 1 + n);
		int l = h, r = h, f = 1;
		for(int i = 1; i <= n; i ++) {
			l -= a[i].tmm - a[i - 1].tmm;
			r += a[i].tmm - a[i - 1].tmm;
			l = max(l, a[i].l);
			r = min(r, a[i].r);
			if(r < l) {
				f = 0;
				break;
			}
		}
		if(f) cout << "Yes\n";
		else cout << "No\n";
	}
	return 0;
}

Submission Info

Submission Time
Task C - Flapping Takahashi
User WangYueHeng
Language C++23 (GCC 15.2.0)
Score 300
Code Size 676 Byte
Status AC
Exec Time 19 ms
Memory 4940 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 1 ms 3636 KiB
01_small_00.txt AC 19 ms 3552 KiB
01_small_01.txt AC 15 ms 3592 KiB
01_small_02.txt AC 15 ms 3480 KiB
01_small_03.txt AC 13 ms 3524 KiB
01_small_04.txt AC 13 ms 3464 KiB
01_small_05.txt AC 12 ms 3520 KiB
01_small_06.txt AC 12 ms 3580 KiB
01_small_07.txt AC 12 ms 3592 KiB
02_random_00.txt AC 10 ms 4564 KiB
02_random_01.txt AC 13 ms 4832 KiB
02_random_02.txt AC 13 ms 4816 KiB
02_random_03.txt AC 11 ms 4660 KiB
02_random_04.txt AC 13 ms 4760 KiB
02_random_05.txt AC 13 ms 4916 KiB
02_random_06.txt AC 10 ms 4504 KiB
02_random_07.txt AC 12 ms 4892 KiB
02_random_08.txt AC 13 ms 4832 KiB
02_random_09.txt AC 7 ms 4276 KiB
02_random_10.txt AC 13 ms 4860 KiB
02_random_11.txt AC 13 ms 4800 KiB
02_random_12.txt AC 13 ms 4752 KiB
02_random_13.txt AC 13 ms 4940 KiB
02_random_14.txt AC 13 ms 4752 KiB
02_random_15.txt AC 13 ms 4860 KiB
02_random_16.txt AC 13 ms 4788 KiB
02_random_17.txt AC 12 ms 4744 KiB
02_random_18.txt AC 13 ms 4796 KiB
02_random_19.txt AC 13 ms 4752 KiB