zoukankan      html  css  js  c++  java
  • BZOJ--1271-秦腾与教学评估

    题目电波: BZOJ--1271-秦腾与教学评估

    枚举点的位置 先判断一共有多少个人数 人数%2==0 说明不符合 

    之后枚举点的位置 看左边人数是奇数还是偶数

    #include<bits/stdc++.h>
    using namespace std;
    #define LL long long
    #define maxn 200005
    LL a[maxn],b[maxn],c[maxn];
    int main(){
       int t;
       cin>>t;
       while(t--){
          int n;
          bool fa=0;
          cin>>n;
          LL r=0;
          LL sum=0;
          for(int j=1;j<=n;j++){
             scanf("%lld%lld%lld",&a[j],&b[j],&c[j]);
             sum+=1+(b[j]-a[j])/c[j];
             r=max(r,b[j]);
          }
          if(sum%2==0) fa=1;
          if(fa) printf("Poor QIN Teng:(
    ");
          else{
            sum=0;
            LL l=1;
            LL mid;
            while(l<=r){
               LL ans=0;
               mid=1LL*(l+r)/2;
               for(int j=1;j<=n;j++){
                  if(a[j]<=mid&&mid<=b[j]){
                     ans+=1+(mid-a[j])/c[j];
                  }else if(mid>b[j]){
                     ans+=1+(b[j]-a[j])/c[j];
                  }
               }
               if(ans%2){
                   r=mid-1;
               }else{
                   l=mid+1;
               }
            }
            for(int j=1;j<=n;j++){
                if(l>=a[j]&&l<=b[j]){
                    if((l-a[j])%c[j]==0) sum++;
                }
            }
            printf("%lld %lld
    ",l,sum);
          }
       }
    }
  • 相关阅读:
    python中的keys、values、items
    python中的del
    python中的reverse
    python中的remove
    python中的pop
    zookeeper for windows
    express
    js undefine,null 和NaN
    Think_php入口文件配置
    jquery 集合操作
  • 原文地址:https://www.cnblogs.com/Dvelpro/p/10061655.html
Copyright © 2011-2022 走看看