| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我还能说什么 。。。。
////////// WAAAAAAAAAAAA
int main()
{
int n, m, x, D, ans, cmd;
while(~scanf("%d%d", &n, &m))
{
build(1, 1, n);
while(m--)
{
scanf("%d%d", &cmd, &x);
if(cmd==1)
{
if(tree[1].tlen < x) ans = 0;
else ans = query(1, 1, n, x);
printf("%d\n", ans);
update(1, 1, n, ans, ans+x-1, 1); // 1: 占用
}
else
{
scanf("%d", &D);
update(1, 1, n, x, x+D-1, 0); // 0: 恢复空房间状态
}
}
}
return 0;
}
////////// ACCCCCCCCCCCCCCCC
int main()
{
int n, m, x, D, ans, cmd;
while(~scanf("%d%d", &n, &m))
{
build(1, 1, n);
while(m--)
{
scanf("%d", &cmd);
if(cmd==1)
{
scanf("%d",&x);
if(tree[1].tlen < x)
{
puts("0");
continue;
}
ans = query(1, 1, n, x);
printf("%d\n", ans);
update(1, 1, n, ans, ans+x-1, 1); // 1: 占用
}
else
{
scanf("%d%d", &x,&D);
update(1, 1, n, x, x+D-1, 0); // 0: 恢复空房间状态
}
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator