結果

問題 No.670 log は定数
ユーザー TsReaperTsReaper
提出日時 2018-03-26 20:32:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,888 ms / 4,000 ms
コード長 773 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 42,244 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 13:16:52
合計ジャッジ時間 30,297 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,781 ms
4,376 KB
testcase_01 AC 2,527 ms
4,380 KB
testcase_02 AC 2,687 ms
4,380 KB
testcase_03 AC 2,597 ms
4,376 KB
testcase_04 AC 2,685 ms
4,376 KB
testcase_05 AC 2,497 ms
4,380 KB
testcase_06 AC 2,761 ms
4,376 KB
testcase_07 AC 2,888 ms
4,384 KB
testcase_08 AC 2,676 ms
4,376 KB
testcase_09 AC 2,523 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
using namespace std;

int n,q,A[200010];
unsigned long long seed;
long long ans;

int next()
{
    seed = seed ^ (seed << 13);
    seed = seed ^ (seed >> 7);
    seed = seed ^ (seed << 17);
    return (seed >> 33);
}

void step(int x,int &y,int v)
{
    while(y > 0 && A[y] >= x) y -= v;
    if(y < 0) y = 0;
    while(y < n && A[y+1] < x) y += v;
    if(y > n) y = n;
}

int main()
{
    int i,x,y,z;

    scanf("%d%d%llu",&n,&q,&seed);
    for(i=0;i<10000;i++) next();
    for(i=1;i<=n;i++) A[i] = next();
    sort(A+1,A+n+1);

    for(i=0;i<q;i++)
    {
        x = next();
        y = 1LL*x*n >> 31;
        if(y > n) y = n;
        step(x,y,15); step(x,y,1);
        ans ^= 1LL*i*y;
    }
    printf("%lld",ans);
    return 0;
}
0