好神的构造题
vfk巨巨的
//minamoto#include#define R register#define fp(i,a,b) for(R int i=a,I=b+1;i I;--i)#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)using namespace std;char buf[1<<21],*p1=buf,*p2=buf;inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}int read(){ R int res,f=1;R char ch; while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1); for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0'); return res*f;}char sr[1<<21],z[20];int C=-1,Z=0;inline void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}void print(R int x,R char ch){ if(C>1<<20)Ot();if(x<0)sr[++C]='-',x=-x; while(z[++Z]=x%10+48,x/=10); while(sr[++C]=z[Z],--Z);sr[++C]=ch;}int n,m,now,tot,las,res,ans;int main(){// freopen("testdata.in","r",stdin); n=read(),m=read(); for(R int i=1;(i+1)*(i+1)<=n;++i){ now=0,tot=n; fd(j,i,1)now+=tot,tot-=2*j+1; now+=tot;if(now>ans)ans=now,res=i; }tot=las=0; fd(i,res,1){ fp(j,1,(i<<1))printf("%d %d\n",tot+j,tot+j+1); if(tot)printf("%d %d\n",las,tot+i+1); las=tot+i+1,tot+=(i<<1)+1; }if(!res)las=tot=1; while(tot