Bryce1010模板

http://codeforces.com/contest/1008/problems

#include <bits/stdc++.h>

using namespace std;
#define ll long long
const int MAXN=1e5+10;
const int INF=0x3f3f3f3f;
struct REC
{
    int w,h;
}rec[MAXN];

int n;
int main()
{
    //cout << "Hello world!" << endl;
    cin>>n;
    rec[0].h=INF;
    bool flag=true;
    for(int i=1;i<=n;i++)
    {
        cin>>rec[i].w>>rec[i].h;
        if(max(rec[i].w,rec[i].h)<=rec[i-1].h)
            rec[i].h=max(rec[i].w,rec[i].h);
        else if(min(rec[i].w,rec[i].h)<=rec[i-1].h)
            rec[i].h=min(rec[i].w,rec[i].h);
        else if(min(rec[i].w,rec[i].h)>rec[i-1].h)
            flag=false;
    }
    if(flag)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

相关文章:

  • 2021-10-28
  • 2021-10-18
  • 2021-08-05
  • 2021-09-03
  • 2021-11-29
  • 2021-08-08
  • 2021-10-25
  • 2021-12-13
猜你喜欢
  • 2021-09-14
  • 2021-06-11
  • 2021-10-26
  • 2021-05-17
  • 2021-09-12
  • 2021-08-15
相关资源
相似解决方案