Two points water problem. Why write this question, because to discern the read and output of long long.
After two days of debugging (I thought I wrote the wrong code) ...
Found CODEVS,TYVJ input and output with Lld,vijos i64d
This is not the only one I should see. So there must be a lot of people going into the pits.
Alas
#include <cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<iostream>using namespacestd;Const intMAXN =200000+Ten;Const intMAXW =2000000;intn,m;Long LongS[MAXN],T[MAXN];intW[MAXN],V[MAXN];intL[MAXN],R[MAXN];intL,r,mid;Long Longres,res2,s1;Long Longsolve () {t[0]=0; s[0]=0; res=0LL; for(intI=1; i<=n;i++) if(w[i]>=mid) {T[i]=t[i-1]+1; S[i]=(Long Long) s[i-1]+V[i]; } Else{T[i]=t[i-1]; S[i]=s[i-1]; } for(intI=1; i<=m;i++) Res+ = (t[r[i]]-t[l[i]-1]) * (s[r[i]]-s[l[i]-1]); returnRes;}intMain () {scanf ("%d%d%lld",&n,&m,&S1); L=0; r=Maxw; for(intI=1; i<=n;i++) {scanf ("%d%d",&w[i],&V[i]); R=Max (r,w[i]); } for(intI=1; i<=m;i++) scanf ("%d%d",&l[i],&R[i]); R++; Res2=10000000000000000LL; while(l<r) {Mid= (l+r) >>1; Long Longres =solve (); Res2=min (Res2,abs (res-S1)); if(RES>S1) l=mid+1; ElseR=mid; } for(inti=l;i<=r;i++) solve (); cout<<res2<<'\ n'; return 0;}
codeVS1138, intelligent quality supervisor.