commit adb365022cdc009c054406e3771b1b6ea70c2acd Author: ljcjames Date: Thu Aug 11 21:46:01 2022 +0800 init diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e1cbb16 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +*.xlsx filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.pptx filter=lfs diff=lfs merge=lfs -text +*.ppt filter=lfs diff=lfs merge=lfs -text +*.doc filter=lfs diff=lfs merge=lfs -text +*.docx filter=lfs diff=lfs merge=lfs -text +*.xls filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b4b25b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.exe +Thumbs.db +~$* diff --git a/8.1/2022暑假训练题01:最小费用最大流.url b/8.1/2022暑假训练题01:最小费用最大流.url new file mode 100644 index 0000000..52cc828 --- /dev/null +++ b/8.1/2022暑假训练题01:最小费用最大流.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,11 +[InternetShortcut] +IDList= +URL=https://vjudge.net/contest/507272 diff --git a/8.1/最大流20220522.pptx b/8.1/最大流20220522.pptx new file mode 100644 index 0000000..87e7c9e --- /dev/null +++ b/8.1/最大流20220522.pptx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55b60f1ce7c2cf0cf8825665173e2143db3fe8c66a77c1b8631bb398a0868229 +size 1264755 diff --git a/8.1/最小费用最大流20220801.pptx b/8.1/最小费用最大流20220801.pptx new file mode 100644 index 0000000..fe1a569 --- /dev/null +++ b/8.1/最小费用最大流20220801.pptx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fee721358d7026e1fa451b534d4276c89de146e320b59579f2a255ff7319b3e9 +size 415684 diff --git a/8.1/最短路径20210809.pptm b/8.1/最短路径20210809.pptm new file mode 100644 index 0000000..75392a7 Binary files /dev/null and b/8.1/最短路径20210809.pptm differ diff --git a/8.10/A - 门.cpp b/8.10/A - 门.cpp new file mode 100644 index 0000000..4ca1c82 --- /dev/null +++ b/8.10/A - 门.cpp @@ -0,0 +1,119 @@ +#include +#include +#include +#include +using namespace std; +const double inf=1e100,EPS=1e-6; +const int W=20; +double l,now; +int n; +struct wall +{ + double x,y[6],val[5]; +} w[W]; +//big bug:double->int +double length(double x1,double y1,double x2,double y2) +{ + double x=x1-x2,y=y1-y2; + return sqrt(x*x+y*y); +} +double cross(double x1,double y1,double x2,double y2) +{ + return x1*y2-x2*y1; +} +double same(double x0,double y0,double x3,double y3,double x1,double y1,double x2,double y2) +{ + double x=x3-x0,y=y3-y0;//y0->x0 + return cross(x,y,x1-x0,y1-y0)*cross(x,y,x2-x0,y2-y0); +} +//WA double жҪ +int sign(double d) +{ + if(fabs(d)0? 1:-1; +} +bool ob(int li,int lj,int ri,int rj) +{ + for(int i=li+1; i>w[i].x; + for(int j=1; j<=4; j++)// j + { + scanf("%lf",&w[i].y[j]); +// cin>>w[i].y[j]; + } + } + w[++n].x=10; + w[n].y[1]=5; + w[n].val[1]=inf;// bug ûֵ + doit(); + printf("%.2lf\n",w[n].val[1]); + } + +} diff --git a/8.10/B - 玩具.cpp b/8.10/B - 玩具.cpp new file mode 100644 index 0000000..dea7c1f --- /dev/null +++ b/8.10/B - 玩具.cpp @@ -0,0 +1,70 @@ +//https://vjudge.net/contest/508277#problem/B +#include +#include +#include +#include +using namespace std; +const double inf=1e100,EPS=1e-6; +const int N=5e3+1; +double l,now; +int n,m; +struct edge +{ + int x[3],y[3],w;//int->double +} a[N]; +#define xy x1,y1 +#define double int +double cross(double x1,double y1,double x2,double y2) +{ +// printf("(%d,%d)(%d,%d):%d\n",x1,y1,x2,y2,x1*y2-x2*y1) ; + return x1*y2-x2*y1; +} +//l,rû +void find(int l,int r,int mid,int x1,int y1) +{ +// printf("l:%d,r:%d,mid:%d(%d,%d),x1:%d,y1:%d\n",l,r,mid,a[mid].x[0],a[0].y[0],x1,y1); + if(l==r) + { + a[l].w++; + return ;//ֽûreturn + } + if(cross(a[mid].x[0],a[0].y[0],x1-a[mid].x[1],y1-a[0].y[1])<=0)//˳ʱ-ʱ+ + { + find(l,mid-1,(l+mid)/2,xy); + } + else + { + find(mid,r,(mid+r+1)/2,xy); + } +} +int main() +{ + while(1) + { + scanf("%d",&n); + if(n==0) return 0; + int x1,y1; + memset(a,0,sizeof(edge)*(n+1)); + scanf("%d%d%d%d%d",&m,&a[0].x[1],&a[0].y[1],&a[0].x[2],&a[0].y[2]); + a[0].x[2]=a[0].x[1]; + a[0].x[0]=a[0].x[2]-a[0].x[1]; + a[0].y[0]=a[0].y[2]-a[0].y[1]; + for(int i=1;i<=n;i++) + { + scanf("%d%d",&a[i].x[1],&a[i].x[2]); + a[i].x[0]=a[i].x[2]-a[i].x[1]; +// cout< +#include +#include +#include +#include +using namespace std; +const int N=3e4+1,N2=N<<1,inf=0x3f3f3f3f;//N2 ˫߼ǵ*2 +int to[N2],h[N2],ne[N2]; +int nid[N],oid[N],top[N],w[N],dep[N],fa[N]; +int siz[N],son[N];//ڵر߶ӣsizĶӣ +int a[N<<2]; +int t,u,v,w1,qu,n,m,cnt=0; +char opt; + +#define ls rt<<1 +#define rs rt<<1|1 +#define mid ((l+r)>>1) //>>1д>>2 +#define lson ls,l,mid //lд1 +#define rson rs,mid+1,r +#define len (r-l+1) +void add(int u,int v) +{ + to[++cnt]=v; + ne[cnt]=h[u]; + h[u]=cnt; +} +//߶ +int tot=0; +void build(int rt,int l,int r) +{ + if(l==r) + { + a[rt]=w[oid[l]]; +// printf("l:%d,qm[%d]=w[%d]=%d\n",l,rt,oid[l],qm[rt]); + return; + } +// if(rt<=mid) + build(ls,l,mid); +// else + build(rs,mid+1,r); +// printf("a[%d]=a[%d]%d/a[%d]%d\n",rt,ls,qm[ls],rs,qm[rs]); +} +inline void pushdown(int rt) +{ + a[ls]+=a[rt]; + a[rs]+=a[rt]; + a[rt]=0; +} +inline int q(int rt,int l,int r,int u) +{ + if(l==r) + { +// printf("[%d]",rt); + return a[rt]; + } + pushdown(rt); + int res=0; + if(u<=mid)res=q(lson,u); + if(u>mid)res=q(rson,u); + return res; +} +//߶ +inline void dfs1(int u,int f,int deep) +{ + fa[u]=f; + dep[u]=deep; + siz[u]=1; + for(int i=h[u]; i; i=ne[i]) + { + int v=to[i];//bug int + if(v==f) continue;//bug ź +// printf("(wo[%d]=val[%d]=%d)\n",v,i,val[i]); + dfs1(v,u,deep+1); + siz[u]+=siz[v]; + if(son[u]==0||siz[v]>siz[son[u]]) + { + son[u]=v; + } + } +// printf("out:%d:fa:%d,dep:%d,siz:%d\n",u,f,deep,siz[u]); +} +inline void dfs2(int u,int tp) +{ + nid[u]=++cnt; + oid[cnt]=u; + top[u]=tp; +// printf("%d:nid:%d,nw:%d,top:%d\n",u,cnt,wo[u],topf); + if(!son[u]) return; + dfs2(son[u],tp); + for(int i=h[u]; i; i=ne[i]) + { + v=to[i]; + if(v!=fa[u]&&v!=son[u]) + { + dfs2(v,v); + } + } +} +inline void change(int L,int R,int w1,int rt,int l,int r) +{ + if(L<=l&&r<=R) + { + a[rt]+=w1; +// printf("u:%d,a[%d]=%d(l=r=%d)\n",u,rt,w1,l); + } + else + { + if(u<=mid) + { + change(L,R,w1,lson); + } + else change(L,R,w1,rson); +// printf("u:%d,a[%d]=a[%d]%d/a[%d]%d\n",u,rt,ls,a[ls],rs,a[rs]); + } +} +int main() +{ + scanf("%d%d%d",&n,&m,&qu); + cnt=0; + for(int i=1; i<=n; i++) + { + scanf("%d",&w[i]); + } + for(int i=1; i<=m; i++) + { + scanf("%d%d",&u,&v);// һ%d c0000005 APPCRASH +// printf("(%d)",i); + add(u,v); + add(v,u); + } + dfs1(1,0,1); + cnt=0; + dfs2(1,1); + build(1,1,cnt); + printf("(%d)",qu); + while(qu--) + { + scanf("%c",&opt);//"&" + if(opt=='I') + { + scanf("%d%d%d",&u,&v,&w1);//%d,˱û%d + change(nid[u],nid[v],w1,1,1,cnt); + + } + else if(opt=='D') + { + scanf("%d%d%d",&u,&v,&w1); + change(nid[u],nid[v],w1*-1,1,1,cnt); + } + else + { + scanf("%d",&u); + printf("%d\n",q(1,1,n,u)); + } + } + return 0; +} diff --git a/8.10/E - Intersection.cpp b/8.10/E - Intersection.cpp new file mode 100644 index 0000000..9872a3c --- /dev/null +++ b/8.10/E - Intersection.cpp @@ -0,0 +1,105 @@ +#include +#include +#include +#include +using namespace std; +const double inf=1e100,EPS=1e-6; +const int N=5; +double cr0,cr1; +int n,s,j,bx[2],by[2],init; +struct xy +{ + int x,y; +} v[N],d[N],e[2]; +//WA double жҪ +int sign(double d) +{ + if(fabs(d)0? 1:-1; +} +double cross(double x1,double y1,double x2,double y2) +{ + return x1*y2-x2*y1; +} +int same(double x0,double y0,double x3,double y3,double x1,double y1,double x2,double y2) +{ + double x=x3-x0,y=y3-y0;//y0->x0 + int a=sign(cross(x,y,x1-x0,y1-y0)),b=sign(cross(x,y,x2-x0,y2-y0)); + //WA*N ߶ͬһֱϵĵûغϲ֣ôͨʵ鷵صཻʹˣټϿų + if(a==0&&b==0) + { + if(max(x0,x3)max(x1,x2)||max(y0,y3)max(y1,y2)) + { + return 1; + } + } + if(a<0&&b<0) + { + return 2; + } + return a*b; +} +int main() +{ + scanf("%d",&n); + while(n--) + { + for(int i=0; i<2; i++) + { + scanf("%d%d",&e[i].x,&e[i].y);//& + } + for(int i=0; i<2; i++) + { + scanf("%d%d",&bx[i],&by[i]); + } + for(int i=1; i +#include +#include +#include +using namespace std; +const int N=101; +double ans; +int n,j; +struct dot +{ + int x,y;//int->double +} a[N]; +double cross(double x1,double y1,double x2,double y2) +{ +// printf("(%d,%d)(%d,%d):%d\n",x1,y1,x2,y2,x1*y2-x2*y1) ; + return x1*y2-x2*y1; +} +int main() +{ + while(1) + { + scanf("%d",&n); + if(n==0) return 0; + ans=0; + memset(a,0,sizeof(dot)*(n+1)); + for(int i=1; i<=n; i++) + { + scanf("%d%d",&a[i].x,&a[i].y); + } + for(int i=1; i<=n; i++) + { + j=i%n+1; + ans+=(cross(a[i].x,a[i].y,a[j].x,a[j].y)/2); + } + printf("%.1lf\n",ans);//Presentation Error + } + return 0; +} diff --git a/8.10/H - area.cpp b/8.10/H - area.cpp new file mode 100644 index 0000000..a614c97 --- /dev/null +++ b/8.10/H - area.cpp @@ -0,0 +1,54 @@ +//H - +//https://vjudge.net/contest/508277#problem/H +#include +#include +#include +#include +#include +using namespace std; +const int N=101; +double s; +int n,i,j,tmp,e,m,t; +struct dot +{ + int x,y;//int->double +} a[N]; +double cross(double x1,double y1,double x2,double y2) +{ +// printf("(%d,%d)(%d,%d):%d\n",x1,y1,x2,y2,x1*y2-x2*y1) ; + return x1*y2-x2*y1; +} +int gcd(int a,int b) +{ + if(a +#include +#include +#include +#include +using namespace std; +const int N=101; +double s; +int n,i,j,tmp,e,m,t; +struct dot +{ + int x,y;//int->double +} a[N]; +double cross(double x1,double y1,double x2,double y2) +{ +// printf("(%d,%d)(%d,%d):%d\n",x1,y1,x2,y2,x1*y2-x2*y1) ; + return x1*y2-x2*y1; +} +int gcd(int a,int b) +{ +// if(a +#include +#include +#include +#include +using namespace std; +const int N=3e4+1,N2=N<<1,inf=0x3f3f3f3f;//N2 ˫߼ǵ*2 +int to[N2],h[N2],ne[N2]; +int nid[N],oid[N],top[N],w[N],dep[N],fa[N]; +int siz[N],son[N];//ڵر߶ӣsizĶӣ +int qs[N<<2],qm[N<<2]; +int t,u,v,w1,qu,n,cnt=0,maxson; +char opt[11]; + +#define ls rt<<1 +#define rs rt<<1|1 +#define mid ((l+r)>>1) //>>1д>>2 +#define lson ls,l,mid //lд1 +#define rson rs,mid+1,r +#define len (r-l+1) +void add(int u,int v) +{ + to[++cnt]=v; + ne[cnt]=h[u]; + h[u]=cnt; +} +//߶ +int tot=0; +void build(int rt,int l,int r) +{ + if(l==r) + { + qm[rt]=w[oid[l]]; + qs[rt]=w[oid[l]]; +// printf("l:%d,qm[%d]=w[%d]=%d\n",l,rt,oid[l],qm[rt]); + return; + } +// if(rt<=mid) + build(ls,l,mid); +// else + build(rs,mid+1,r); + qm[rt]=max(qm[ls],qm[rs]); + qs[rt]=qs[ls]+qs[rs];//bug TLEֱӵ +// printf("a[%d]=a[%d]%d/a[%d]%d\n",rt,ls,qm[ls],rs,qm[rs]); +} +inline int qmax(int rt,int l,int r,int L,int R) +{ + if(L<=l&&r<=R) + { +// printf("[%d]",rt); + return qm[rt]; + } + + int res=-inf; + if(L<=mid)res=max(res,qmax(lson,L,R)); + if(R>mid)res=max(res,qmax(rson,L,R)); + return res; +} +inline int qsum(int rt,int l,int r,int L,int R) +{ + if(L<=l&&r<=R) + { +// printf("[%d]",rt); + return qs[rt]; + } + + int res=0; + if(L<=mid)res+=qsum(lson,L,R); + if(R>mid)res+=qsum(rson,L,R); + return res; +} +//߶ +inline int q(int u,int v,bool tag) +{ + + int res=0; + if(tag) res=-inf; + while(top[u]!=top[v]) + { + if(dep[top[u]]dep[v]) swap(u,v); +// printf("(%d,%d,%d)",nid[u],nid[v],res); + if(tag)res=max(res,qmax(1,1,n,nid[u],nid[v]));//son[u]->uȨڶӣӶӺͰְֵ·Ҫųְ + else res+=qsum(1,1,n,nid[u],nid[v]);//ϣǵȨͲ + return res; +} +inline void dfs1(int u,int f,int deep) +{ + fa[u]=f; + dep[u]=deep; + siz[u]=1; + for(int i=h[u]; i; i=ne[i]) + { + int v=to[i];//bug int + if(v==f) continue;//bug ź +// printf("(wo[%d]=val[%d]=%d)\n",v,i,val[i]); + dfs1(v,u,deep+1); + siz[u]+=siz[v]; + if(son[u]==0||siz[v]>siz[son[u]]) + { + son[u]=v; + } + } +// printf("out:%d:fa:%d,dep:%d,siz:%d\n",u,f,deep,siz[u]); +} +inline void dfs2(int u,int tp) +{ + nid[u]=++cnt; + oid[cnt]=u; + top[u]=tp; +// printf("%d:nid:%d,nw:%d,top:%d\n",u,cnt,wo[u],topf); + if(!son[u]) return; + dfs2(son[u],tp); + for(int i=h[u]; i; i=ne[i]) + { + v=to[i]; + if(v!=fa[u]&&v!=son[u]) + { + dfs2(v,v); + } + } +} +inline void pushup(int rt) +{ + qm[rt]=max(qm[ls],qm[rs]); + qs[rt]=qs[ls]+qs[rs]; +} +inline void change(int u,int w1,int rt,int l,int r) +{ + if(l==r) + { + qm[rt]=w1; + qs[rt]=w1; +// printf("u:%d,a[%d]=%d(l=r=%d)\n",u,rt,w1,l); + } + else + { + if(u<=mid) + { + change(u,w1,lson); + } + else change(u,w1,rson); + pushup(rt); +// printf("u:%d,a[%d]=a[%d]%d/a[%d]%d\n",u,rt,ls,a[ls],rs,a[rs]); + } +} +int main() +{ +//freopen("10.in","r",stdin); +//freopen("out.txt","w",stdout); + scanf("%d",&n); + cnt=0; +// cout<<"\\"; + for(int i=1; i