关于程序的运行时间和手动编译
NOIP好像又要去那个zz的RZYZ。。给SD选手一点提示吧。。
首先,那里的dev-cpp是4点几的,也就是说程序运行完没有运行时间。也就是没有这个:

那该怎么优越地卡常呢?
可以使用ctime来:
#include <cstdio>
#include <ctime>
using namespace std;
main()
{
double a,b;
int ans=0;
a=clock();
for (int i=1;i<=1000010;i++)
for (int j=1;j<=1001;j++)
ans++;
b=clock();
double times=(b-a)/CLOCKS_PER_SEC;
printf("%d\n",ans);
printf("%lf\n",times);
}
不要开O2运行下这个程序,就可以看到时间了。
记住上交的时候去掉ctime。
来着ISA学长的忠告:不要用ctime卡常,因为在linux下ctime返回值是微秒,windows下是毫秒。
关于手动编译。如下图:

也就是在不同的编译器下,有时候iostream是万能库,用了以后都能编译过,但是交上去就会ce。(在你们的电脑上不一定会编译过。)
但是在那边的电脑上,一定会装上和评测一样的编译器。
如何编译呢?先win+R,输入cmd,你大概会看到这种东西。


现在我们要转到文件所在的目录。一般默认都在c盘。比如我的在:C:\Users\Administrator
现在输入e:
转到e盘,然后用cd
命令转到文件夹里。

编译命令是g++ -o 文件名.exe 文件名.cpp
发现没编译过。

就是map没有头文件。
该如何开栈呢?我先写个$10^6$级别的链剖。
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstdlib>
#define M 2000010
#define N 1000010
#define min(x,y) ((x<y)?(x):(y))
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
using namespace std;
typedef long long LL;
LL inline read()
{
LL 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;
}
struct node
{
LL to,next;
}e[M];
LL tot,st[M],deep[N],siz[N],fa[N],son[N],val[N],top[N],v[N],id[N],pos[N],t;
LL n,m,x,y,z,root,mod,com,ans,ql,qr;
void add(LL x,LL y)
{
e[++tot].to=y;
e[tot].next=st[x];
st[x]=tot;
}
LL dfs_id=0;
void dfs1(LL now,LL pre,LL depth)
{
LL maxs=-0x3f3f3f3f;
deep[now]=depth;
siz[now]=1;
fa[now]=pre;
for (LL i=st[now];i;i=e[i].next)
if (e[i].to!=pre)
{
dfs1(e[i].to,now,depth+1);
siz[now]+=siz[e[i].to];
if (maxs<siz[e[i].to])
son[now]=e[i].to,maxs=siz[e[i].to];
}
}
void dfs2(LL now,LL tops)
{
top[now]=tops;
id[++dfs_id]=now;
pos[now]=dfs_id;
val[dfs_id]=v[now];
if (son[now]!=0)
dfs2(son[now],tops);
for (LL i=st[now];i;i=e[i].next)
if (e[i].to!=fa[now]&&e[i].to!=son[now])
dfs2(e[i].to,e[i].to);
}
LL seg[4*N];
LL mark[4*N];
void pushup(LL rt)
{
seg[rt]=(seg[rt<<1]+seg[rt<<1|1]);
}
void pushdown(LL rt,LL x)
{
if (mark[rt])
{
mark[rt<<1]=(mark[rt<<1]+mark[rt]);
mark[rt<<1|1]=(mark[rt<<1|1]+mark[rt]);
seg[rt<<1]=(seg[rt<<1]+mark[rt]*(x-x/2));
seg[rt<<1|1]=(seg[rt<<1|1]+mark[rt]*(x/2));
mark[rt]=0;
}
}
void build(LL rt,LL l,LL r)
{
if (l==r)
seg[rt]=val[l];
else
{
LL mid=(l+r)/2;
build(lson);
build(rson);
pushup(rt);
}
}
LL query(LL rt,LL l,LL r,LL L,LL R)
{
if (l>=L && r<=R)
return seg[rt];
else
{
pushdown(rt,r-l+1);
LL mid=(r+l)/2,x=0;
if (mid>=L)
x+=query(lson,L,R);
if (mid<R)
x+=query(rson,L,R);
return x;
}
}
void update(LL rt,LL l,LL r,LL L,LL R,LL x)
{
if (l>=L && r<=R)
seg[rt]=(seg[rt]+(r-l+1)*x),mark[rt]=(mark[rt]+x);
else
{
pushdown(rt,r-l+1);
LL mid=(r+l)/2;
if (mid>=L)
update(lson,L,R,x);
if (mid<R)
update(rson,L,R,x);
pushup(rt);
}
}
void add_path(LL x,LL y,LL z)
{
while(top[x]!=top[y])
{
if (deep[top[x]]<deep[top[y]]) swap(x,y);
update(1,1,n,pos[top[x]],pos[x],z);
x=fa[top[x]];
}
if (deep[x]<deep[y]) swap(x,y);
update(1,1,n,pos[y],pos[x],z);
}
LL sum_path(LL x,LL y)
{
LL ans=0;
while(top[x]!=top[y])
{
if (deep[top[x]]<deep[top[y]]) swap(x,y);
ans=(ans+query(1,1,n,pos[top[x]],pos[x]));
x=fa[top[x]];
}
if (deep[x]<deep[y]) swap(x,y);
ans=(ans+query(1,1,n,pos[y],pos[x]));
return ans;
}
void add_sub(LL x,LL y)
{
update(1,1,n,pos[x],pos[x]+siz[x]-1,y);
}
LL sum_sub(LL x)
{
return query(1,1,n,pos[x],pos[x]+siz[x]-1);
}
main()
{
freopen("in.txt","r",stdin);
scanf("%d%d",&n,&root);
for (LL i=1;i<=n-1;i++)
scanf("%d%d",&x,&y),add(x,y),add(y,x);
deep[0]=-1;
dfs1(root,0,1);
dfs2(root,root);
build(1,1,n);
system("pause");
}
(其实是个不错的板子。。
这是数据
#include <cstdio>
using namespace std;
main()
{
freopen("in.txt","w",stdout);
puts("1000000 1");
for (int i=1;i<1000000;i++)
printf("%d %d\n",i,i+1);
}
毫无疑问的爆栈了

现在编译的时候可以开下栈。
g++ -o 文件名.exe 文件名.cpp -Wl,--stack=100000000
后面是大小,可以自己定的。

然后就果断没有爆栈。
最后就祝大家NOIP2017RP++吧。