Submission #71320929
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using pll = pair<ll,ll>;
int ans=0;
void sol(){
int a,b,n,h,c,d,u,l,ma,mi,now,t;
cin>>n>>h;
ma=h; mi=h; now=0;
vector<vector<int>> ba(n,vector<int>(3,0));
for(int i=0;i<n;i++){
cin>>ba[i][0]>>l>>u;
ba[i][2]=max(u,l);
ba[i][1]=min(u,l);
}
sort(ba.begin(),ba.begin()+n);
for(int i=0;i<n;i++){
ma=ma+ba[i][0]-now;
mi=max(0,mi-ba[i][0]+now);
now=ba[i][0];
if(mi>ba[i][2]||ma<ba[i][1]){
cout<<"No\n";
return;
}
ma=min(ma,ba[i][2]);
mi=max(mi,ba[i][1]);
}
cout<<"Yes\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0)
; long long int t;
cin>>t;
while(t--){
sol();
}
return 0;
}
Submission Info
| Submission Time |
|
| Task |
C - Flapping Takahashi |
| User |
normalsigner |
| Language |
C++23 (GCC 15.2.0) |
| Score |
300 |
| Code Size |
912 Byte |
| Status |
AC |
| Exec Time |
24 ms |
| Memory |
8912 KiB |
Compile Error
./Main.cpp: In function 'void sol()':
./Main.cpp:9:9: warning: unused variable 'a' [-Wunused-variable]
9 | int a,b,n,h,c,d,u,l,ma,mi,now,t;
| ^
./Main.cpp:9:11: warning: unused variable 'b' [-Wunused-variable]
9 | int a,b,n,h,c,d,u,l,ma,mi,now,t;
| ^
./Main.cpp:9:17: warning: unused variable 'c' [-Wunused-variable]
9 | int a,b,n,h,c,d,u,l,ma,mi,now,t;
| ^
./Main.cpp:9:19: warning: unused variable 'd' [-Wunused-variable]
9 | int a,b,n,h,c,d,u,l,ma,mi,now,t;
| ^
./Main.cpp:9:35: warning: unused variable 't' [-Wunused-variable]
9 | int a,b,n,h,c,d,u,l,ma,mi,now,t;
| ^
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
300 / 300 |
| Status |
|
|
| 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 |
3588 KiB |
| 01_small_00.txt |
AC |
24 ms |
3572 KiB |
| 01_small_01.txt |
AC |
19 ms |
3540 KiB |
| 01_small_02.txt |
AC |
19 ms |
3552 KiB |
| 01_small_03.txt |
AC |
17 ms |
3628 KiB |
| 01_small_04.txt |
AC |
16 ms |
3672 KiB |
| 01_small_05.txt |
AC |
16 ms |
3540 KiB |
| 01_small_06.txt |
AC |
16 ms |
3448 KiB |
| 01_small_07.txt |
AC |
16 ms |
3520 KiB |
| 02_random_00.txt |
AC |
16 ms |
7700 KiB |
| 02_random_01.txt |
AC |
20 ms |
8900 KiB |
| 02_random_02.txt |
AC |
19 ms |
8836 KiB |
| 02_random_03.txt |
AC |
17 ms |
8136 KiB |
| 02_random_04.txt |
AC |
19 ms |
8912 KiB |
| 02_random_05.txt |
AC |
19 ms |
8896 KiB |
| 02_random_06.txt |
AC |
15 ms |
7736 KiB |
| 02_random_07.txt |
AC |
19 ms |
8900 KiB |
| 02_random_08.txt |
AC |
20 ms |
8760 KiB |
| 02_random_09.txt |
AC |
11 ms |
6344 KiB |
| 02_random_10.txt |
AC |
20 ms |
8912 KiB |
| 02_random_11.txt |
AC |
19 ms |
8784 KiB |
| 02_random_12.txt |
AC |
19 ms |
8784 KiB |
| 02_random_13.txt |
AC |
19 ms |
8784 KiB |
| 02_random_14.txt |
AC |
19 ms |
8860 KiB |
| 02_random_15.txt |
AC |
19 ms |
8784 KiB |
| 02_random_16.txt |
AC |
19 ms |
8708 KiB |
| 02_random_17.txt |
AC |
20 ms |
8780 KiB |
| 02_random_18.txt |
AC |
19 ms |
8852 KiB |
| 02_random_19.txt |
AC |
19 ms |
8852 KiB |