快读
inline int read() { int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar(); return x*f; }
归并排序
void msort(int left ,int right) { int mid=(left+right)/2; int pos_l=left; int pos_r=mid+1; int pos=left; if(left>=right) return; msort(left,mid); msort(mid+1,right); while(pos_l<=mid && pos_r<=right) { if(a[pos_l] <= a[pos_r]) temp[pos++]=a[pos_l++]; else temp[pos++]=a[pos_r++]; } while(pos_l<=mid) temp[pos++]=a[pos_l++]; while(pos_r<=right) temp[pos++]=a[pos_r++]; while(left<=right) { a[left]=temp[left]; left++; } }
O2优化(吸氧)
#pragma GCC optimize(2)
标签:ch,int,代码,pos,mid,有用,right,日常,left From: https://www.cnblogs.com/LiuYT2004/p/17784730.html