結果

問題 No.670 log は定数
ユーザー TsReaperTsReaper
提出日時 2018-03-26 20:27:18
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,089 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 42,064 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-07 13:14:02
合計ジャッジ時間 48,673 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
#define STEP 100
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);
}

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

    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); A[n+1] = (1LL<<31) - 1;

    for(i=0;i<q;i++)
    {
        x = next();
        y = 1LL*x*n/A[n];
        if(y > n) y = n;

        for(z=STEP,last=-1;!(A[y]<x && A[y+1]>=x);)
        {
            if(y > 0 && A[y] >= x)
            {
                y -= z;
                if(y < 0) y = 0;
                if(last == 1) z = (z+1)>>1;
                last = 0;
            }
            else if(y < n && A[y+1] < x)
            {
                y += z;
                if(y > n) y = n;
                if(last == 0) z = (z+1)>>1;
                last = 1;
            }
        }

        ans ^= 1LL*i*y;
    }
    printf("%lld",ans);
    return 0;
}
0