提交记录 3584


用户 题目 状态 得分 用时 内存 语言 代码长度
wither noi17a. 【NOI2017】整数 Accepted 100 400.584 ms 20052 KB C++11 1.91 KB
提交时间 评测时间
2018-07-16 16:42:05 2020-07-31 21:20:18
#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.13 us48 KBAcceptedScore: 4

Testcase #259.69 us48 KBAcceptedScore: 4

Testcase #3330.22 us68 KBAcceptedScore: 4

Testcase #4642.27 us92 KBAcceptedScore: 4

Testcase #5789.49 us140 KBAcceptedScore: 4

Testcase #6909.29 us136 KBAcceptedScore: 4

Testcase #71.581 ms320 KBAcceptedScore: 4

Testcase #81.41 ms164 KBAcceptedScore: 4

Testcase #95.6 ms740 KBAcceptedScore: 4

Testcase #107.449 ms472 KBAcceptedScore: 4

Testcase #118.829 ms280 KBAcceptedScore: 4

Testcase #129.54 ms1 MB + 96 KBAcceptedScore: 4

Testcase #1313.668 ms1 MB + 500 KBAcceptedScore: 4

Testcase #1442.157 ms4 MB + 36 KBAcceptedScore: 4

Testcase #1548.946 ms4 MB + 572 KBAcceptedScore: 4

Testcase #1687.849 ms7 MB + 952 KBAcceptedScore: 4

Testcase #1784.054 ms1 MB + 268 KBAcceptedScore: 4

Testcase #18145.26 ms11 MB + 836 KBAcceptedScore: 4

Testcase #19177.085 ms13 MB + 788 KBAcceptedScore: 4

Testcase #20400.584 ms17 MB + 968 KBAcceptedScore: 4

Testcase #21179.597 ms13 MB + 408 KBAcceptedScore: 4

Testcase #22162.232 ms2 MB + 236 KBAcceptedScore: 4

Testcase #23170.974 ms6 MB + 148 KBAcceptedScore: 4

Testcase #24172.794 ms2 MB + 376 KBAcceptedScore: 4

Testcase #25273.324 ms19 MB + 596 KBAcceptedScore: 4


Judge Duck Online | 评测鸭在线
Server Time: 2025-06-27 12:24:29 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠