BZOJ1510: [POI2006]Kra-The Disks 二分+前缀和
题解:
真.傻逼题
如果实在不会的话看我代码。
代码:
#include<cstdio> #include<cstring> #include<cctype> #include<iostream> #include<algorithm> using namespace std; int getc(){ static const int L=1<<15; static char buf[L],*S=buf,*T=buf; if(S==T){ T=(S=buf)+fread(buf,1,L,stdin); if(S==T) return EOF; } return*S++; } int getint(){ int c; while(!isdigit(c=getc())); int x=c-'0'; while(isdigit(c=getc())) x=(x<<1)+(x<<3)+c-'0'; return x; } #define N 300010 #define inf 0x3f3f3f3f int a[N]; int main(){ int n=getint(),m=getint(),i; for(a[0]=inf,i=1;i<=n;++i) a[i]=min(a[i-1],getint()); int down=n+1,x,l,r,mid; bool ok=1; while(m--){ x=getint(); if(down==1||a[1]<x){ ok=0; break; } for(l=1,r=down-1;l<r;){ if(a[mid=(l+r+1)>>1]<x) r=mid-1; else l=mid; } down=l; } printf("%d",ok?down:0); return 0; }
Sep 02, 2022 09:34:02 PM
Jessore Divisional education board of Bangladesh has successfully conducted the Grade 8th terminal examination tests for both Junior School Certificate & Junior Dakhil Certificate course students at all districts under the division to the academic year of 2022, there are a huge number of students are appeared from all Secondary schools under the board like as previous years, JSC Result jessore Board and this is most important examination tests for class 8th standard students of the country.Government of Bangladesh, Secondary and Higher Secondary Education Board has successfully completed the JSC & JDC examinations in the month of November 2022 to all eligible students of the division at all selected examination centers at all rural and urban area schools, both of Junior School Certificate & Junior Dakhil Certificate terminal exams are conducted as per date sheet announced by all education board Bangladesh.
Jan 17, 2024 09:34:15 PM
오피타임's therapists pay attention to every detail during massages.
Jan 18, 2024 04:49:43 AM
제주출장마사지's serene ambiance adds to the overall experience.