問題一覧 > 通常問題

No.670 log is a Constant

レベル : / 実行時間制限 : 1ケース 4.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 67
作問者 : yosupot / テスター : sigma425
お気に入りにしたユーザー ProblemId : 1886 / 自分の提出
問題文最終更新日: 2026-06-26 06:07:00
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 187 (順位表) の他の問題:

Problem Statement


You are given a sequence $a_i$ of length $N$ and $Q$ queries. Each query is as follows.

  • Given $x$, find the number of elements of ${a_i}$ that are less than $x$.

Note that the sizes of the sequence and the number of queries are given in the input, but their contents are both generated by a random number generator.

For the output, let $r_i$ be the result of the $i(i = 1,2,...,Q)$-th query, and
print the xor of all $r_i \times (i-1)$.

That is, let $s_i = r_i \times (i-1)$, and print $s_1 \oplus s_2 \oplus ... \oplus s_Q$.

The query results are combined in order to reduce the time spent on output (the intended solution does obtain the answers to all queries).

A naive solution to this problem (code that outputs the correct answer but takes a very long time to run) is provided for three languages, C++, Java, and D. Refer to it for how the input is generated. For these three languages, there are intended solutions that fit within the time limit. (C++: 1461ms, Java: 3627ms (what?), D: 2721ms)

Source code

Input

N Q Seed


$N = 2 \times 10^5$
$Q = 5 \times 10^7$
$1 \leq Seed \leq 10^9$
$0 \leq a_i, x \leq 2^{31} - 1$

Output

Print a newline at the end.

Sample

Sample 1
Input
3 5 100
Output
11

$\{a_i\} = \{574298591, 668652393, 1255298759\}$, and the queries are, in order,
$1374848783, 844241532, 121207337, 1805629405, 534777954$.

This case does not satisfy the input constraints.

Sample 2
Input
50000 100000 1194
Output
5935406007

The provided naive solution can still run at this size. (It may take several tens of seconds.)

This case does not satisfy the input constraints either.

Sample 3
Input
200000 50000000 2525
Output
4959527808339

If you run the provided naive solution on this case, it is doubtful that the result will come back before the contest ends. Please be careful.

This case satisfies the input constraints.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。