結果
| 問題 |
No.670 log は定数
|
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2018-03-23 23:14:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3,823 ms / 4,000 ms |
| コード長 | 1,256 bytes |
| コンパイル時間 | 672 ms |
| コンパイル使用メモリ | 85,928 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-24 22:49:09 |
| 合計ジャッジ時間 | 38,513 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
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 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());
ll sm = 0;
int w;
int c;
double b1 = 1.0 / ((long long)1 << 31);
double it = n*b1;
for (int i = 0; i < q; i++) {
int x = next();
c = (double)x * n * b1;
//cerr << c << endl;
/*if (c < 0 || c >= n) {
cerr << x << " " << n << " " << b1 << endl;
cerr << c << endl;
}*/
w = n;
while (true) {
if (a[c] < x) {
if (c == n - 1 || a[c + 1] >= x) {
c++;
break;
}
w = max(2.0, min(w - 2.0,(x - a[c]) * it));
c += w;
if (c >= n)c = n - 1;
}
else {
if (c == 0 || a[c - 1] < x)break;
w = max(2.0, min(w - 2.0, (a[c] - x) * it));
c -= w;
if (c < 0)c = 0;
}
}
sm ^= ll(c) * i;
}
cout << sm << endl;
return 0;
}
ats5515