1349B - Orac and Medians(思维)

https://codeforces.com/problemset/problem/1349/B


思路:长度为2/3的区间满足其一定可以满足。

#include
#include
#include
#include
#include
#include
#include
#include
#include
#define debug(a) cout<<#a<<"="<>t;
   while(t--){
       LL n,k;cin>>n>>k;
       bool flag=0;
       for(LL i=1;i<=n;i++){
           cin>>a[i];
           if(a[i]==k) flag=1,a[i]=1;
           else if(a[i]>k) a[i]=2;
           else if(a[i]n) continue;
                  if(a[i]&&a[j]){
                     ok=1;
                  }
              }
          }
          if(ok){
             cout<<"yes"<<"\n";
          }
          else cout<<"no"<<"\n";
       }
   }
   return 0;
}

 

你可能感兴趣的:(思维,构造)