woc这题有毒

P1314 [NOIP2011 提高组] 聪明的质监员

赵灵儿 @ 2018-04-19 13:41:48

woc这题有毒,我把答案的初值从20021109改成999999999999999就从25变85了qwq


by newbie314159 @ 2018-04-19 14:13:06

这也叫有毒


by cqxxx @ 2018-04-19 14:13:55

亦菲!!!!!


by λᴉʍ @ 2018-04-19 14:18:37

这也叫有毒


by star_magic_young @ 2018-04-19 14:27:33

这不是题目有毒了,,,


by 长河落日 @ 2018-04-19 14:38:15

应该是您有毒


by 硫代硫酸钠 @ 2018-04-19 15:09:50

应该是您有毒


by 赵灵儿 @ 2018-04-19 15:12:10

(⊙o⊙)…85分死活调不出来了跪求大佬改错qwq

#include<bits/stdc++.h>
#define int long long
#define N 300010
using namespace std;
namespace program{
    int ll,rr,w[N],val[N],l[N],r[N];
    int fnum[N],fval[N],ans=999999999999999;
    int n,m,s;
    inline int check(int x){
        memset(fnum,0,sizeof fnum);
        memset(fval,0,sizeof fval);
        for(int i=1;i<=n;i++){
            if(w[i]>=x)
                fnum[i]=fnum[i-1]+1,fval[i]=fval[i-1]+val[i];
            else
                fnum[i]=fnum[i-1],fval[i]=fval[i-1];
        }
        int oo=0;
        for(int i=1;i<=m;i++)
            oo+=(fnum[r[i]]-fnum[l[i]-1])*(fval[r[i]]-fval[l[i]-1]);
        return oo;  
    }
    inline void work(){
        scanf("%lld%lld%lld",&n,&m,&s);
        for(int i=1;i<=n;i++)   
            scanf("%lld%lld",&w[i],&val[i]),ll=min(w[i],ll),rr=max(rr,w[i]);
        for(int i=1;i<=m;i++)
            scanf("%lld%lld",&l[i],&r[i]);
        ll-=3,rr+=3;
        while(ll<rr){
            int mid=(ll+rr)>>1;
            int sum=check(mid);
            if(sum>s)
                ll=mid+1;
            else
                rr=mid-1;
            ans=min(ans,abs(s-sum));
        }printf("%lld\n",ans);
    }
}
signed main(){
    freopen("233.in","r",stdin);
    freopen("233.out","w",stdout);
    program::work();
    return 0;
}

by λᴉʍ @ 2018-04-19 15:14:33

应该是您有毒


by newbie314159 @ 2018-04-19 15:21:37

应该是您有毒


by iotang @ 2018-04-19 15:50:03

怎么又是你


| 下一页