結果
問題 | No.670 log は定数 |
ユーザー |
|
提出日時 | 2018-03-26 08:49:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2,026 ms / 4,000 ms |
コード長 | 1,358 bytes |
コンパイル時間 | 1,119 ms |
コンパイル使用メモリ | 111,000 KB |
実行使用メモリ | 303,936 KB |
最終ジャッジ日時 | 2024-06-25 06:40:17 |
合計ジャッジ時間 | 24,075 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#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; }