結果

問題 No.670 log は定数
ユーザー mamekinmamekin
提出日時 2018-03-26 08:49:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,053 ms / 4,000 ms
コード長 1,358 bytes
コンパイル時間 1,182 ms
コンパイル使用メモリ 109,692 KB
実行使用メモリ 303,796 KB
最終ジャッジ日時 2023-09-07 12:35:58
合計ジャッジ時間 24,920 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,996 ms
303,796 KB
testcase_01 AC 1,967 ms
303,544 KB
testcase_02 AC 2,053 ms
303,584 KB
testcase_03 AC 2,024 ms
303,588 KB
testcase_04 AC 2,011 ms
303,732 KB
testcase_05 AC 1,994 ms
303,608 KB
testcase_06 AC 2,018 ms
303,792 KB
testcase_07 AC 2,043 ms
303,600 KB
testcase_08 AC 2,041 ms
303,664 KB
testcase_09 AC 2,048 ms
303,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

const int MAX = INT_MAX;
const int SIZE = 200;

int main()
{
    int n, q;
    cin >> n >> q >> seed;

    for(int i=0; i<10000; ++i)
        next();

    vector<int> a(n);
    for(int i=0; i<n; ++i)
        a[i] = next();
    sort(a.begin(), a.end());

    vector<int> cnt(MAX / SIZE + 2, 0);
    vector<vector<int> > v(MAX / SIZE + 1);
    for(int i=0; i<n; ++i){
        ++ cnt[a[i]/SIZE+1];
        v[a[i]/SIZE].push_back(a[i]);
    }
    for(int i=0; i<=MAX/SIZE; ++i)
        cnt[i+1] += cnt[i];

    long long ans = 0;
    for(int i=0; i<q; ++i){
        int x = next();
        int y = cnt[x/SIZE];
        y += lower_bound(v[x/SIZE].begin(), v[x/SIZE].end(), x) - v[x/SIZE].begin();
        ans ^= y * (long long)i;
    }
    cout << ans << endl;

    return 0;
}
0