Finally a more formal NOIP simulation, write a small summary. The topic is nothing to say, most of it is simple, first put the code.
1111 T1
String//by cydiater//2016.11.11#include <iostream> #include <cstring> #include <iomanip> #include <queue> #include <map> #include <ctime> #include <cmath> #include <cstdlib> #include < cstdio> #include <algorithm> #include <bitset> #include <set> #include <string>using namespace STD; #define LL Long long#define up (i,j,n) for (int. i=j;i<=n;i++) #define DOWN (i,j,n) for (int i=j;i>=n;i--) #define CMAX (A, B) A=max (A, b) #define Cmin (A, B) A=min (A, b) #define FILE "string" const int Maxn=2e5+5;const int oo= 0x3f3f3f3f;char q[maxn];int head,tail;namespace solution{void slove () {char ch;head=1;tail=0;while (scanf ("%c",& CH) {!=eof) {bool Flag=1;while (Tail>=head&&ch==q[tail]) {tail--;flag=0;} if (flag) q[++tail]=ch;} Up (I,head,tail) if (q[i]!= ' \ n ' &&q[i]!= ' \ R ') printf ("%c", Q[i]);p UTS ("");}} int main () {freopen (file ".", "R", stdin), freopen (file ". Out", "w", stdout); using namespace Solution;slove (); return 0;}
1111 T2
Plus//by cydiater//2016.11.11#include <iostream> #include <iomanip> #include <queue> #include < map> #include <ctime> #include <cstdlib> #include <cstring> #include <string> #include < algorithm> #include <bitset> #include <set> #include <cmath> #include <cstdio>using namespace STD; #define LL Long long#define up (i,j,n) for (int. i=j;i<=n;i++) #define DOWN (i,j,n) for (int i=j;i>=n;i--) #define CMAX (A, B) A=max (A, b) #define Cmin (A, B) A=min (A, b) #define FILE "plus" const int maxn=1e6+5;const int oo=0x3f3f3f3f; inline int read () {char ch=getchar (); int x=0,f=1;while (ch> ' 9 ' | | ch< ' 0 ') {if (ch== '-') F=-1;ch=getchar ();} while (ch>= ' 0 ' &&ch<= ' 9 ') {x=x*10+ch-' 0 '; Ch=getchar ();} return x*f;} int z,ans[maxn],flag=-1,len=oo,test[maxn],t[maxn],top=0,head,tol;namespace solution{//1 X First 0 Y first-1 noneint gcd (int a,int b) {return B==0?A:GCD (b,a%b);} void Init () {z=read ();} void Updata (int x,int y) {top=0;while (x!=1&&y!=1) {if (X>y) {head=1;t[++top]=x/y;x%=y;} Else{head=0;t[++top]=y/x;y%=x;}} if (x==1&&y>1) {t[++top]=y-x;head=0;} else if (y==1&&x>1) {t[++top]=x-y;head=1;} if (head==0&&flag==1) return;if (flag==-1| | (head==1&&flag==0)) {flag=head;tol=top;up (i,1,top) ans[i]=t[i];} Else{int Now=1,opt=flag;up (i,0,top-1) {if (t[top-i]>ans[tol-i]&&opt==1) | | (t[top-i]<ans[tol-i]&&opt==0)) {flag=head;tol=top;up (i,1,top) Ans[i]=t[i];return;} else if ((t[top-i]<ans[tol-i]&&opt==1) | | | (t[top-i]>ans[tol-i]&&opt==0)) return;opt^=1;}}} int get (int x,int y) {int tmp=0;if (x<y) swap (x, y), while (y!=0) {tmp+=x/y;x%=y;if (x<y) swap (x, y);} return TMP;} void Slove () {memset (test,10,sizeof (test)), up (i,1,z) if (gcd (i,z) ==1) cmin (Len, (Test[i]=get (Z,i)-1)), and up (i,1,z) if ( Test[i]==len) Updata (z,i);} void output () {down (i,tol,1) {up (J,1,ans[i]) if (flag) printf ("X"), Else printf ("Y"); flag^=1;} Puts ("");}} int main () {freopen (file ".", "R", stdin), freopen (file ". Out", "w", stdout); using namespace solution;Init (); slove (); output (); return 0;}
1111 T3 (80 points, 100 points too cancer not changed)
Aiur//by cydiater//2016.11.11#include <iostream> #include <queue> #include <map> #include < ctime> #include <cmath> #include <cstring> #include <algorithm> #include <cstdlib> #include <cstdio> #include <iomanip> #include <string> #include <bitset> #include <set>using namespace STD; #define LL Long long#define up (i,j,n) for (int. i=j;i<=n;i++) #define DOWN (i,j,n) for (int i=j;i>=n;i--) #define CMAX (A, B) A=max (A, b) #define Cmin (A, B) A=min (A, b) #define FILE "aiur" const int maxn=2e6+5;const int oo=0x3f3f3f3f; inline int read () {char ch=getchar (); int x=0,f=1;while (ch> ' 9 ' | | ch< ' 0 ') {if (ch== '-') F=-1;ch=getchar ();} while (ch>= ' 0 ' &&ch<= ' 9 ') {x=x*10+ch-' 0 '; Ch=getchar ();} return x*f;} int n,ty;ll ans=0,f[maxn];struct xy{int x, y;} XY[MAXN];p riority_queue<int,vector<int>,greater<int> >num1,num2;//smallpriority_queue<int >num3,num4;//bignamespace solution1{/*f[i]=f[i-1]+abs (XI-XJ) +abs (YI-YJ) F[i]=f[i-1]+max (XI-XJ,XJ-XI) +max (yi-yj,yj-yi)////////////////////////////////////////////f[i]=f[i-1]+ (xi+yi)-(Xj+yj) (1) f[i]=f[ i-1]+ (Xi-yi)-(Xj-yj) (2) f[i]=f[i-1]-(xi-yi) + (XJ-YJ) (3) f[i]=f[i-1]-(xi+yi) + (XJ+YJ) (4) Sort by-(xj+yj)-(XJ-YJ) ( XJ-YJ) (Xj+yj) Slove me in O (NLOGN) + part*/void init () {up (i,1,n) {int x=read (), Y=read (); xy[i]= (XY) {x, y};}} void push (int id) {int sum=xy[id].x+xy[id].y,delta=xy[id].x-xy[id].y;num1.push (sum); Num2.push (delta); Num3.push ( Delta); Num4.push (sum);} void Slove () {push (1); up (I,2,n) {ll tmp=0,n1=num1.top (), N2=num2.top (), N3=num3.top (), N4=num4.top (), x=xy[i].x,y=xy[i ].y;tmp=max (X+y-n1,max (X-y-n2,max (y-x+n3,n4-x-y)); Ans+=tmp;push (i);} Cout<<ans<<endl;}} Namespace Solution2{void init () {up (i,0,n-1) {int x=read (), Y=read (); xy[i]= (XY) {x, y};}} int get (int sta,int id) {int tmp=0;up (i,0,n-1) if ((1<<i) &sta) = = (1<<i)) Cmax (Tmp,abs (xy[id].x-xy[i].x ) +abs (XY[ID].Y-XY[I].Y)); return TMP;} void Slove () {memset (f,10,sizeof (f)); F[0]=0;up (i,1, (1<<n)-1) {Up (j,0,n-1) if (i& (1<<J)) {int sta=i^ (1<<J); Cmin (F[i],f[sta]+get (Sta,j));}} cout<<f[(1<<n) -1]<<endl;}} int main () {freopen (file ".", "R", stdin), freopen (file ". Out", "w", stdout); N=read (); Ty=read (); if (ty==1) {using namespace solution1;init (); Slove ();} else {using namespace solution2;init (); Slove ();} return 0;}
1112 T1
Array//by cydiater//2016.11.12#include <iostream> #include <iomanip> #include <queue> #include <map> #include <ctime> #include <cmath> #include <cstring> #include <string> #include < algorithm> #include <cstdlib> #include <cstdio> #include <bitset> #include <set>using namespace STD; #define LL Long long#define up (i,j,n) for (int. i=j;i<=n;i++) #define DOWN (i,j,n) for (int i=j;i>=n;i--) #define CMAX (A, B) A=max (A, b) #define Cmin (A, B) A=min (A, b) #define Auto (I,node) for (int i=link[node];i;i=e[i].next) # Define FILE "array" const int MAXN=1E5+5;CONST int Oo=0x3f3f3f3f;inline int read () {char ch=getchar (); int X=0,f=1;while (CH > ' 9 ' | | ch< ' 0 ') {if (ch== '-') F=-1;ch=getchar ();} while (ch>= ' 0 ' &&ch<= ' 9 ') {x=x*10+ch-' 0 '; Ch=getchar ();} return x*f;} int n,link[maxn],len=0,lable[maxn],id[maxn],num,node=0,cnt=0,fa[maxn];struct edge{int Y,next;} E[maxn<<1];char opt[5];namespace solution{inline void Insert (int x,int y) {e[++len].next=LINK[X]; Link[x]=len;e[len].y=y;} void Slove () {n=read (); memset (fa,0,sizeof (FA)); Memset (Link,0,sizeof (LINK)); Memset (Lable,0,sizeof (lable)); lable[0 ]=-1;up (j,1,n) {scanf ("%s", opt+1); Id[j]=node;if (opt[1]== ' a ') {num=read (); bool flag=1; Auto (I,node) if (lable[e[i].y]==num) {flag=0;node=e[i].y;} if (flag) {Insert (node,++cnt); lable[cnt]=num;fa[cnt]=node;node=cnt;}} else if (opt[1]== ' s ') node=fa[node];else{num=read (); node=id[num];} printf ("%d\n", Lable[node]);}}} int main () {freopen (file ".", "R", stdin), freopen (file ". Out", "w", stdout); using namespace Solution;slove (); return 0;}
1112 T2
Blossom//by cydiater//2016.11.12#include <iostream> #include <cstdlib> #include <iomanip># Include <algorithm> #include <cstdio> #include <cmath> #include <ctime> #include <cstring > #include <string> #include <map> #include <queue> #include <bitset> #include <set> using namespace std; #define LL Long long#define up (i,j,n) for (ll i=j;i<=n;i++) #define DOWN (i,j,n) for (LL i=j;i>=n; i--) #define CMAX (A, B) A=max (A, b) #define Cmin (A, B) A=min (A, b) #define FILE "Blossom" inline int read () {char ch=getchar (); int X=0,f=1;while (ch> ' 9 ' | | ch< ' 0 ') {if (ch== '-') F=-1;ch=getchar ();} while (ch>= ' 0 ' &&ch<= ' 9 ') {x=x*10+ch-' 0 '; Ch=getchar ();} return x*f;} ll n,m,lim1,lim2,ans=0;namespace solution{int gcd (int a,int b) {return b==0?a:gcd (b,a%b);} void Init () {n=read (); M=read (); Lim1=read (); Lim2=read ();} void Slove () {if (lim1<=1) ans+= (n (m+1) + (n+1) *m), Up (i,1,n) up (j,1,m) if (gcd (i,j) ==1) {if (i*i+j*j>=lim1*lim1 &&I*I+J*J<=LIM2*LIM2) ans+= (n-i+1) * (m-j+1) * *;} Cout<<ans<<endl;}} int main () {freopen (file ".", "R", stdin), freopen (file ". Out", "w", stdout); using namespace Solution;init (); Slove (); return 0;}
1112 T3
Chen//by cydiater//2016.11.12#include <iostream> #include <cstring> #include <string> #include <cstdio> #include <cstdlib> #include <iomanip> #include <algorithm> #include <queue># Include <map> #include <bitset> #include <set> #include <cmath> #include <ctime>using namespace STD; #define LL Long long#define up (i,j,n) for (int. i=j;i<=n;i++) #define DOWN (i,j,n) for (int i=j;i>=n;i--) #define CMAX (A, B) A=max (A, b) #define Cmin (A, B) A=min (A, b) #define FILE "Chen" const int maxn=1e6+5;const int oo=0x3f3f3f3f; inline int read () {char ch=getchar (); int x=0,f=1;while (ch> ' 9 ' | | ch< ' 0 ') {if (ch== '-') F=-1;ch=getchar ();} while (ch>= ' 0 ' &&ch<= ' 9 ') {x=x*10+ch-' 0 '; Ch=getchar ();} return x*f;} ll N,num[maxn],a[maxn],pos,l,r,v,k[maxn],top=0,num[maxn];ll y=0;struct tree{int Delta,v,maxx;} T[maxn<<2];namespace solution{inline void downit (int root) {int delta=t[root].delta;t[root].delta=0;if (delta== 0) Return;t[root<<1].delta+=delTa;t[root<<1|1].delta+=delta;t[root<<1].v+=delta;t[root<<1|1].v+=delta;t[root<<1].maxx +=delta;t[root<<1|1].maxx+=delta;} inline void reload (int root) {t[root].v=min (T[ROOT<<1].V,T[ROOT<<1|1].V); T[root].maxx=max (t[root< <1].maxx,t[root<<1|1].maxx);} inline int Get (int x) {int Leftt=1,rightt=top,mid;while (LEFTT+1<RIGHTT) {mid= (leftt+rightt) >>1;if (Num[mid] >x) Rightt=mid;else Leftt=mid;} if (num[leftt]==x) return Leftt;return Rightt;} void Init () {n=read (); Up (I,1,n) num[i]=a[i]=read (); sort (num+1,num+n+1), Up (I,1,n) if (num[i]!=num[i-1]) num[++top]= num[i];memcpy (num,num,sizeof (num)); up (I,1,n) A[i]=get (A[i]);} int get (int leftt,int rightt,int root) {if (Leftt!=rightt) downit (Root), if (t[root].maxx==0) return leftt;if (t[root].v== 0&&LEFTT==RIGHTT) return leftt;if (t[root].v>0) return oo;int mid= (leftt+rightt) >>1;return min (Get ( leftt,mid,root<<1), get (mid+1,rightt,root<<1|1));} void Updata (int leftt,int rightt,int root) {if (Leftt!=rightt) downit (root); if (leftt>r| | Rightt<l) return;if (leftt>=l&&rightt<=r) {T[root].delta+=v;t[root].v+=v;t[root].maxx+=v;return;} int mid= (LEFTT+RIGHTT) >>1;updata (leftt,mid,root<<1); Updata (mid+1,rightt,root<<1|1); Reload ( root);} void res (int leftt,int rightt,int root) {if (leftt==rightt) {K[leftt]=t[root].v;return;} Downit (root), int mid= (LEFTT+RIGHTT) >>1;res (leftt,mid,root<<1); res (mid+1,rightt,root<<1|1); Reload (root);} void Slove () {up (i,1,n) {pos=get (1,n,1); l=1; R=a[i];v=1;updata (1,n,1); if (a[i]+1<=pos-1) {l=a[i]+1; R=pos-1;v=-1;updata (1,n,1);} Y+=num[a[i]];} Pos=get (1,n,1); res (1,n,1); up (I,1,pos) y-=k[i]* (num[i]-num[i-1]); Cout<<y<<endl;}} int main () {freopen (file ".", "R", stdin), freopen (file ". Out", "w", stdout); using namespace Solution;init (); Slove (); return 0;}
This two play is relatively stable, there is no serious mistake. And now I realize that it's really powerful to shoot. The idea of the past may be just T3 need to take a shot, T1 and T2 do not need to shoot. The two T1 and T2 have chosen to write the violence before the positive solution, and then throw it and then go to the next question. In fact, the significance of shooting T1 is not big, but after the mentality will be a lot of stability, can understand how many points are already stable. When you do the next question, the mentality will not be so panic.
High when the Noip and the provincial election are hung very miserable, each time is regretted and return. Minshen said he was too much emphasis on theory and light practice led to a detour. I think I was too heavy practice, a certain level of competition test must not be what you knocked. Constantly learning new things is nothing wrong, slow and slow results may not be so brilliant, but this is the last chance, two days to stabilize the first two questions, is success.
NOIp 11.11/12