結果

問題 No.670 log は定数
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2018-03-24 00:58:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,807 ms / 4,000 ms
コード長 2,321 bytes
コンパイル時間 1,794 ms
コンパイル使用メモリ 171,052 KB
実行使用メモリ 8,100 KB
最終ジャッジ日時 2023-09-07 08:05:04
合計ジャッジ時間 33,221 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,744 ms
8,020 KB
testcase_01 AC 2,762 ms
8,060 KB
testcase_02 AC 2,758 ms
8,020 KB
testcase_03 AC 2,756 ms
7,928 KB
testcase_04 AC 2,742 ms
8,036 KB
testcase_05 AC 2,737 ms
8,040 KB
testcase_06 AC 2,807 ms
7,980 KB
testcase_07 AC 2,759 ms
8,100 KB
testcase_08 AC 2,766 ms
7,980 KB
testcase_09 AC 2,759 ms
7,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/








//---------------------------------------------------------------------------------------------------
using ll = long long;
using ull = unsigned long long;

ull seed;
int next() {
    seed = seed ^ (seed << 13);
    seed = seed ^ (seed >> 7);
    seed = seed ^ (seed << 17);
    return (seed >> 33);
}
//---------------------------------------------------------------------------------------------------
int N, Q;
const int NV = 301010;
int cnt2[101010];
vector<int> dic[101010];
void _main() {
    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();
    
    rep(i, 0, N) {
        cnt2[a[i] / NV]++;
        dic[a[i] / NV].push_back(a[i]);
    }
    rep(i, 1, 101010) cnt2[i] += cnt2[i - 1];
    rep(i, 0, 101010) sort(all(dic[i]));

    ll sm = 0;
    for (int i = 0; i < Q; i++) {
        int x = next();

        int cnt = 0;
        int y = x / NV;
        if(y) cnt += cnt2[y - 1];
        cnt += lower_bound(all(dic[y]), x) - dic[y].begin();
        sm ^= ll(cnt) * i;
    }
    cout << sm << endl;
}
0