A:
#include <iostream>usingnamespace std; int Main () { int n; CIN>>N; cout<< (n1)/5+1
B:
#include <iostream>using namespacestd;intN;intpos[ the];intCNT;#defineRep (i,j,k) for (int i=j;i<=k;i++)typedefLong Longll;intMain () {CIN>>N; Rep (I,1, N) { intnum; CIN>>num; if(num==1) {CNT++; POS[CNT]=i; }} ll ans=1; Rep (I,1, cnt-1) {ans*= (LL) (pos[i+1]-Pos[i]); } if(pos[1]) cout<<ans<<Endl; Elsecout<<"0";}
C:
#include <iostream>#include<algorithm>using namespacestd;intN;typedefLong Longll;ll x1,y1,x2,y2;structfon{ll x, y; ll Dis1,dis2;} f[ .];#defineRep (i,j,k) for (int i=j;i<=k;i++)BOOLcmp (fon a,fon b) {returna.dis1<b.dis1;}intMain () {CIN>>n>>x1>>y1>>x2>>Y2; Rep (I,1, N) {cin>>f[i].x>>f[i].y; F[i].dis1= (f[i].x-x1) * (f[i].x-x1) + (f[i].y-y1) * (f[i].y-y1); F[i].dis2= (f[i].x-x2) * (F[I].X-X2) + (f[i].y-y2) * (f[i].y-y2); } sort (F+1, f+1+n,cmp); ll ans=1e17; Rep (I,0, N) {LL tmp=0; Rep (J,i+1, N) {tmp=Max (TMP,F[J].DIS2); } ans=min (ans,f[i].dis1+tmp); } if(n==1) ans=min (f[1].dis1,f[1].dis2); cout<<ans;}
D:
#include <iostream>#include<algorithm>using namespacestd;structpoint{intx, y;} p[4];#defineRep (i,j,k) for (int i=j;i<=k;i++)intMain () {CIN>>p[1].x>>p[1].y>>p[2].x>>p[2].y>>p[3].x>>p[3].y; if((p[1].x==p[2].x&&p[2].x==p[3].x) | | (p[1].y==p[2].y&&p[2].y==p[3].y)) {cout<<"1"; return 0; } intTmpi=0, tmpj=0; Rep (I,1,2) Rep (j,i+1,3) { if(p[i].x==p[j].x) {Tmpi=i;tmpj=J; } } if(tmpi&&TMPJ) {Rep (i,1,3) { if(i!=tmpi&&i!=TMPJ) { if(P[i].y>=max (p[tmpi].y,p[tmpj].y) | | p[i].y<=min (p[tmpi].y,p[tmpj].y)) {cout<<"2"; return 0; } }}} Tmpi=tmpj=0; Rep (I,1,2) Rep (j,i+1,3) { if(p[i].y==p[j].y) {Tmpi=i;tmpj=J; } } if(tmpi&&TMPJ) {Rep (i,1,3) { if(i!=tmpi&&i!=TMPJ) { if(P[i].x>=max (p[tmpi].x,p[tmpj].x) | | p[i].x<=min (p[tmpi].x,p[tmpj].x)) {cout<<"2"; return 0; } }}} cout<<"3";}
E:
#include <iostream>#include<algorithm>using namespacestd;intn,m,k;Const intmxn=1e5+Ten;intSeq[mxn];typedefLong Longll;structquery{intL,r,id; ll ans;} Q[mxn];ll exist[20000000+Ten];#defineRep (i,j,k) for (int i=j;i<=k;i++)BOOLcmp (query A,query b) {if(a.l/ -==b.l/ -) returna.r<B.R; returna.l/ -<b.l/ -;}BOOLcmp2 (query A,query b) {returna.id<b.id;}intMain () {CIN>>n>>m>>K; Rep (I,1, N) { intnum; scanf ("%d",&num); Seq[i]=seq[i-1]^num; } Rep (I,1, M) {scanf ("%d%d",&q[i].l,&Q[I].R); Q[i].id=i; Q[I].L--; } sort (Q+1, q+1+m,cmp); intl=q[1].l,r=q[1].R; ll ans=0; Rep (I,l,r) {ans+=exist[k^Seq[i]]; Exist[seq[i]]++; } q[1].ans=ans; Rep (I,2, M) { while(r<Q[I].R) {R++; Ans+=exist[k^Seq[r]]; EXIST[SEQ[R]]++; } while(r>Q[I].R) {Exist[seq[r]]--; Ans-=exist[k^Seq[r]]; R--; } while(l>Q[I].L) {L--; Ans+=exist[k^Seq[l]]; EXIST[SEQ[L]]++; } while(l<Q[I].L) {Exist[seq[l]]--; Ans-=exist[k^Seq[l]]; L++; } Q[i].ans=ans; } sort (Q+1, q+1+M,CMP2); Rep (I,1, m) cout<<q[i].ans<<Endl;}
Codeforces #340 Div2