提交记录 3583


用户 题目 状态 得分 用时 内存 语言 代码长度
wither noi17a. 【NOI2017】整数 Accepted 100 400.377 ms 20052 KB C++ 1.91 KB
提交时间 评测时间
2018-07-16 16:41:31 2020-07-31 21:20:12
#include<bits/stdc++.h>
#define ll long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
const int N = 1e6+7;
char gc()
{
    static char buf[100000], *p1 = buf, *p2 = buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf, 1, 100000, stdin), p1==p2) ? EOF : *p1++;
}
int qr()
{
    char ch = gc();
    int f = 1, sum = 0;
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
        {
            f = -1;
        }
        ch = gc();
    }
    while(ch>='0'&&ch<='9')
    {
        sum = sum*10+ch-'0';
        ch = gc();
    }
    return sum*f;
}
set<int> s;
ui x[N], y[N];
void ADD(ull a, int b, ui* t, ui* an)
{
    int p = b/32, c = b%32;
    ull tmp = (ull)t[p]+(a<<c);
    a = tmp>>32;t[p] = (tmp&(((ull)1<<33)-1));
    if(t[p]^an[p])
    {
        s.insert(p);
    }
    else
    {
        s.erase(p);
    }
    for(int i = p+1; a; i++)
    {
        tmp = (ull)t[i]+a;
        a = (tmp)>>32;t[i] = (tmp&(((ull)1<<33)-1));
        if(t[i]^an[i])
        {
            s.insert(i);
        }
        else
        {
            s.erase(i);
        }
    }
    return;
}
bool query(int k)
{
    int p = k/32, c = k%32;
    ui ans = ((x[p]>>c)^(y[p]>>c))&1;
    ui a = (x[p]&((1<<c)-1)), b = (y[p]&((1<<c)-1));
    if(a<b)
    {
        return ans^1;
    }
    else if(a>b||s.empty()||p<=*s.begin())
    {
        return ans;
    }
    set<int>::iterator it = s.lower_bound(p);it--;
    if(x[*it]>y[*it])
    {
        return ans;
    }
    return ans^1;
}
int main()
{
    int n = qr(), t1 = qr(), t2 = qr(), t3 = qr();
    for(int i = 1; i <= n; i++)
    {
        int o = qr(), a, b, k;
        if(o&1)
        {
            a = qr();
            b = qr();
            if(a>0)
            {
                ADD(a, b, x, y);
            }
            else
            {
                ADD(-a, b, y, x);
            }
        }
        else
        {
            printf("%d\n", query(qr()));
        }
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #140.8 us48 KBAcceptedScore: 4

Testcase #270.76 us48 KBAcceptedScore: 4

Testcase #3337.09 us68 KBAcceptedScore: 4

Testcase #4643.6 us92 KBAcceptedScore: 4

Testcase #5794.53 us140 KBAcceptedScore: 4

Testcase #6913.46 us136 KBAcceptedScore: 4

Testcase #71.575 ms320 KBAcceptedScore: 4

Testcase #81.414 ms164 KBAcceptedScore: 4

Testcase #95.646 ms740 KBAcceptedScore: 4

Testcase #107.454 ms472 KBAcceptedScore: 4

Testcase #118.964 ms280 KBAcceptedScore: 4

Testcase #129.557 ms1 MB + 96 KBAcceptedScore: 4

Testcase #1313.67 ms1 MB + 500 KBAcceptedScore: 4

Testcase #1442.073 ms4 MB + 36 KBAcceptedScore: 4

Testcase #1548.876 ms4 MB + 572 KBAcceptedScore: 4

Testcase #1687.757 ms7 MB + 952 KBAcceptedScore: 4

Testcase #1783.978 ms1 MB + 268 KBAcceptedScore: 4

Testcase #18145.322 ms11 MB + 836 KBAcceptedScore: 4

Testcase #19177.064 ms13 MB + 788 KBAcceptedScore: 4

Testcase #20400.377 ms17 MB + 968 KBAcceptedScore: 4

Testcase #21179.423 ms13 MB + 408 KBAcceptedScore: 4

Testcase #22161.98 ms2 MB + 236 KBAcceptedScore: 4

Testcase #23171.184 ms6 MB + 148 KBAcceptedScore: 4

Testcase #24173.008 ms2 MB + 376 KBAcceptedScore: 4

Testcase #25273.453 ms19 MB + 596 KBAcceptedScore: 4


Judge Duck Online | 评测鸭在线
Server Time: 2024-11-22 13:04:49 | Loaded in 2 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠