Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我还能说什么 。。。。

Posted by 118779 at 2015-07-27 17:09:09 on Problem 3667
//////////  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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator