竞赛讨论区 > D题有没有大佬看看我这个代码,为什么过不了
头像
laiyu
发布于 11-06 22:47 江苏
+ 关注

D题有没有大佬看看我这个代码,为什么过不了

#include<bits/stdc++.h> using namespace std; using ll=long long; const int N=2e5+10; pair<ll,ll> A[N]; int main(){     int T;     cin>>T;     while(T--){         int n;         cin>>n;         for(int i=1;i<=n;i++){             cin>>A[i].first>>A[i].second;         }         sort(A+1,A+1+n);         ll maxn=A[1].second;         int flag=1;         for(int i=2;i<=n;i++){             ll l=A[i].first,r=A[i].second;             if(maxn<l) flag=0;             if(maxn>=r) flag=0;             else maxn=r;         }         if(flag==1) cout<<"Yes"<<endl;         else cout<<"No"<<endl;     }     return 0; }

全部评论

(1) 回帖
加载中...
话题 回帖

等你来战

查看全部

热门推荐