mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-08 02:13:51 +08:00
Add FZOI Codes
This commit is contained in:
34
FZOI/西大附中东区食堂的空调.cpp
Normal file
34
FZOI/西大附中东区食堂的空调.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include<cstdio>
|
||||
|
||||
const int N = 1e2+5;
|
||||
|
||||
int n,m,now=0;
|
||||
int tem[3][N];
|
||||
|
||||
bool check(void){
|
||||
for(int i=0;i<n;++i){
|
||||
int t=tem[0][i],l=tem[1][i],h=tem[2][i];
|
||||
for(;now<=t;++now){
|
||||
if(m<l)++m;
|
||||
if(m>h)--m;
|
||||
if(now==t&&(m<l||m>h))return false;
|
||||
if(m>=l&&m<=h&&i!=n-1){
|
||||
if(m<tem[1][i+1]&&m<h) ++m;
|
||||
if(m>tem[2][i+1]&&m>l) --m;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
signed main(void){
|
||||
scanf("%d%d",&n,&m);
|
||||
for(int j=0;j<n;++j){
|
||||
for(int i=0;i<3;++i){
|
||||
scanf("%d",&tem[i][j]);
|
||||
}
|
||||
}
|
||||
bool flag = check();
|
||||
printf("%d\n",flag?1:0);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user