We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sist2019新生 我的思路是逐一比较每一段的起始位置a[i+1]和前一段的限制b[i]。如果a[i+1]<=b[i],那么就可以,反之只要出现一个就不行。这样写下的代码提交以后卡在test3。题中给的两组测试数据都是ok的,不知道问题出在哪里。 附c代码 `#include <stdio.h> #include <stdbool.h>
int main(){ int n,m; scanf("%d %d",&n,&m); int a[n],b[n]; for(int i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); } bool can=true; for(int i=0;i<n-1;i++){ printf("%d:%d %d\n",i,a[i+1],b[i]); if(a[i+1]>b[i]){ can=false; } } printf("%d:%d %d\n",3,m,b[n-1]); if(b[n-1]<m){ can=false; } if(can){ printf("YES"); }else{ printf("NO"); } scanf("%d",&n); return 0; }`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
sist2019新生
我的思路是逐一比较每一段的起始位置a[i+1]和前一段的限制b[i]。如果a[i+1]<=b[i],那么就可以,反之只要出现一个就不行。这样写下的代码提交以后卡在test3。题中给的两组测试数据都是ok的,不知道问题出在哪里。
附c代码
`#include <stdio.h>
#include <stdbool.h>
int main(){
int n,m;
scanf("%d %d",&n,&m);
int a[n],b[n];
for(int i=0;i<n;i++){
scanf("%d %d",&a[i],&b[i]);
}
bool can=true;
for(int i=0;i<n-1;i++){
printf("%d:%d %d\n",i,a[i+1],b[i]);
if(a[i+1]>b[i]){
can=false;
}
}
printf("%d:%d %d\n",3,m,b[n-1]);
if(b[n-1]<m){
can=false;
}
if(can){
printf("YES");
}else{
printf("NO");
}
scanf("%d",&n);
return 0;
}`
The text was updated successfully, but these errors were encountered: