結果
| 問題 | No.670 log は定数 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-03-26 20:51:10 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 490 ms / 4,000 ms | 
| コード長 | 756 bytes | 
| コンパイル時間 | 326 ms | 
| コンパイル使用メモリ | 36,956 KB | 
| 実行使用メモリ | 6,400 KB | 
| 最終ジャッジ日時 | 2024-06-25 07:25:08 | 
| 合計ジャッジ時間 | 6,062 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |     scanf("%d%d%llu",&n,&q,&seed);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
#include <algorithm>
#define SHIFT 11
using namespace std;
int n,m,q,A[200010];
unsigned long long seed;
long long ans;
int cnt[(1<<(31-SHIFT))+10];
int next()
{
    seed = seed ^ (seed << 13);
    seed = seed ^ (seed >> 7);
    seed = seed ^ (seed << 17);
    return (seed >> 33);
}
int main()
{
    int i,x,y;
    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);
    m = 1<<(31-SHIFT);
    for(i=1;i<=n;i++) cnt[(A[i]>>SHIFT)+1]++;
    for(i=1;i<=m;i++) cnt[i] += cnt[i-1];
    for(i=0;i<q;i++)
    {
        x = next();
        y = cnt[x>>SHIFT];
        for(;y+1<=n && A[y+1]<x;y++);
        ans ^= 1LL*i*y;
    }
    printf("%lld",ans);
    return 0;
}
            
            
            
        