版本比较
P6219
正文
增加 4 行删除 4 行
43 行未改动44454647484849505152525354555657585959606162633 行未改动67686970717172737443 行未改动vector<int>endll,last,now;vector<node>ans;
signed main(){
#ifdef feyn freopen("in.txt","r",stdin); #endif
read(m); if(m==0){printf("3 2\n1 2\n 2 3\n");return 0;} if(m==1){printf("1 0\n");return 0;} if(m==-1){printf("2 1\n1 2\n");return 0;} bool neg=false,op=false;if(m<0)m=-m,neg=true; int lg=1;while((1ll<<lg)<=m)lg++;lg--;
for(int i=lg-1;i>=0;i--){ now.clear();for(int j=0;j<3;j++)now.push_back(++cnt); if(i==lg-1)for(int x:now)ans.push_back((node){1,x});else adding; if(((1ll<<i)&m)==0){last=now;op^=1;continue;}3 行未改动 if(neg==op){now.clear();for(int i=0;i<2;i++)now.push_back(++cnt);adding;} ++cnt;for(int x:now)ans.push_back((node){x,cnt}); printf("%lld %lld\n",cnt,ans.size()); for(node x:ans)printf("%lld %lld\n",x.a,x.b);
return 0;}```