2019.08.10考试报告

题都没改完,所以没有报告

 2019.08.11晚上8点:

终于改完T3了,酸爽啊~~~

考试的心态,做题出现的问题好像没啥记得了。

把坑我的T3代码粘一下吧

 

  1 #include<bits/stdc++.h>
  2 #define AA cout<<"Alita"<<endl
  3 #define DD cout<<"Dybala"<<endl
  4 #define m(a) memset(a,0,sizeof(a))
  5 using namespace std;
  6 const int N=2050;
  7 int pre,tot,n,m,Q,t[N][N],head[N],f[N*N][4],w[N*N];
  8 int a[N],A[N],b[N],B[N],c[N],C[N],d[N],D[N];
  9 inline int read()
 10 {
 11         int sum,k=1;char s;
 12         while(s=getchar(),s<'0'||s>'9') if(s=='-') k=-1;sum=s-'0';
 13         while(s=getchar(),s>='0'&&s<='9') sum=sum*10+s-'0';
 14         return k*sum;
 15 }
 16 int get(int x,int y) 
 17 {
 18         for(int i=0;i<=3;i++) if(f[x][i]==y) return i;
 19         return 0;
 20 }
 21 int change(int x){return (x+2)%4;}
 22 int search(int x,int y)
 23 {
 24         if(x*y==0) return t[x][y];
 25         int ans=f[head[x]][1];
 26         for(int sum=0,i=f[head[x]][1],j=head[x],tmp;sum<y-1;sum++)
 27         {
 28                 tmp=i;
 29                 i=f[i][change(get(i,j))];
 30                 ans=i;
 31                 j=tmp;
 32         }
 33         return ans;
 34 }
 35 signed main()
 36 {
 37         //freopen("1.in","r",stdin);
 38         //freopen("1.out","w",stdout);
 39         n=read();m=read();Q=read();
 40         for(int i=0;i<=n+1;i++)
 41         {
 42                 for(int j=0;j<=m+1;j++)
 43                 {
 44                         t[i][j]=++tot;
 45                 }
 46                 head[i]=t[i][0];
 47         }
 48         for(int i=0;i<=n+1;i++)
 49         {
 50                 for(int j=0;j<=m+1;j++)
 51                 {
 52                         if(i) f[t[i][j]][0]=t[i-1][j];
 53                         f[t[i][j]][1]=t[i][j+1];
 54                         f[t[i][j]][2]=t[i+1][j];
 55                         if(j) f[t[i][j]][3]=t[i][j-1];
 56                 }
 57         }
 58         for(register int i=1;i<=n;++i)
 59         {
 60                 for(register int j=1;j<=m;++j)
 61                 {
 62                         w[t[i][j]]=read();
 63                 }
 64         }
 65         for(register int q=1,x,y,z;q<=Q;q++)
 66         {
 67                 x=read();y=read();z=read();
 68                 if(z==1) continue;
 69                 a[1]=search(x,y); a[2]=search(x,y+1);
 70                 A[1]=search(x-1,y); A[2]=search(x-1,y+1);
 71                 c[1]=search(x+z-1,y); c[2]=search(x+z-1,y+1);
 72                 C[1]=search(x+z,y); C[2]=search(x+z,y+1);
 73                 for(int i=y+2;i<=y+z-1;i++)
 74                 {
 75                         a[i-y+1]=f[a[i-y]][change(get(a[i-y],a[i-y-1]))];
 76                         A[i-y+1]=f[a[i-y+1]][(get(a[i-y+1],a[i-y])+1)%4];
 77                         c[i-y+1]=f[c[i-y]][change(get(c[i-y],c[i-y-1]))];
 78                         C[i-y+1]=f[c[i-y+1]][(get(c[i-y+1],c[i-y])+3)%4];
 79                 }
 80                 b[1]=search(x,y+z-1); b[2]=search(x+1,y+z-1);
 81                 B[1]=search(x,y+z); B[2]=search(x+1,y+z);
 82                 d[1]=search(x,y); d[2]=search(x+1,y);
 83                 D[1]=search(x,y-1); D[2]=search(x+1,y-1);
 84                 for(int i=x+2;i<=x+z-1;i++)
 85                 {
 86                         b[i-x+1]=f[b[i-x]][change(get(b[i-x],b[i-x-1]))];
 87                         B[i-x+1]=f[b[i-x+1]][(get(b[i-x+1],b[i-x])+1)%4];
 88                         d[i-x+1]=f[d[i-x]][change(get(d[i-x],d[i-x-1]))];
 89                         D[i-x+1]=f[d[i-x+1]][(get(d[i-x+1],d[i-x])+3)%4];
 90                 }
 91                 for(int i=1;i<=z;i++) //外部
 92                 {
 93                         f[A[i]][get(A[i],a[i])]=d[z-i+1];
 94                         f[B[i]][get(B[i],b[i])]=a[i];
 95                         f[C[i]][get(C[i],c[i])]=b[z-i+1];
 96                         f[D[i]][get(D[i],d[i])]=c[i];
 97                         f[a[i]][get(a[i],A[i])]=B[i];
 98                         f[b[i]][get(b[i],B[i])]=C[z-i+1];
 99                         f[c[i]][get(c[i],C[i])]=D[i];
100                         f[d[i]][get(d[i],D[i])]=A[z-i+1];
101                 }
102         }
103         for(int i=1,x,y;i<=n;i++)
104         {
105                 x=head[i],y=f[x][1];
106                 for(int j=1,tmp;j<=m;j++)
107                 {
108                         printf("%d ",w[y]);
109                         tmp=y;
110                         y=f[y][change(get(y,x))];
111                         x=tmp;
112                 }
113                 puts("");
114         }
115         return 0;
116 }
T3 7001ms

 

 

 

emmmmm,明天考好点吧

posted @ 2019-08-11 16:48  ATHOSD  阅读(124)  评论(2编辑  收藏  举报