結果
問題 |
No.670 log は定数
|
ユーザー |
![]() |
提出日時 | 2018-04-28 18:11:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,051 bytes |
コンパイル時間 | 673 ms |
コンパイル使用メモリ | 71,744 KB |
実行使用メモリ | 795,008 KB |
最終ジャッジ日時 | 2024-06-27 23:23:02 |
合計ジャッジ時間 | 11,189 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | MLE * 1 -- * 9 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int n, q, b[200009], a[50000009], c[65555], p[50000009]; unsigned long long seed; int main() { cin >> n >> q >> seed; for (int i = 0; i < 10000; i++) { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); } for (int i = 0; i < n; i++) { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); b[i] = (seed >> 33); } sort(b, b + n); for (int i = 0; i < q; i++) { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); a[i] = (seed >> 33); c[(a[i] >> 16) + 1]++; } for (int i = 0; i < 1 << 16; i++) { c[i + 1] += c[i]; } for (int i = 0; i < q; i++) { p[c[a[i] >> 16]++] = i; } for (int i = 0; i < 1 << 16; i++) { sort(p + c[i], p + c[i + 1], [&](int j, int k) { return a[j] < a[k]; }); } int ptr = 0; long long ret = 0; for (int i = 0; i < q; i++) { while (ptr != n && a[p[i]] > b[ptr]) ptr++; ret ^= 1LL * ptr * p[i]; } cout << ret << endl; return 0; }