Logo
(追記) (追記ここまで)

19507번 - Best Division 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB922100.000%

문제

You are given an array $A$ consisting of $N$ integers.

You are also given two integers $K$ and $L$.

You must divide the whole array $A$ into exactly $K$ nonempty intervals so that the length of each interval is not greater than $L$.

The cost of an interval $[S, E]$ is the bitwise XOR sum of all elements of $A$ whose indices are in $[S, E]$.

The score of a division is simply the maximum of the costs of all $K$ intervals in the division. You are interested in the best division: the one which minimizes the score of the division. Since this would be too simple for you, the problem is reversed.

You know the minimum score: the answer for the original problem is not greater than $X$. Now you want to know the maximum value of $K$.

입력

The first line of input contains three integers $N,ドル $X$ and $L$ which are described above (1ドル \le L \le N \le 10^5,ドル 0ドル \le X < 268,435円,456円$).

The next line contains three integers $A_{1},ドル $P$ and $Q$ (0ドル \le A_{1}, P, Q < 268,435円,456円$). All subsequent integers of the array $A$ are generated using these three integers in the following way: for every integer 1ドル < k \le N,ドル $A_{k} = (A_{k - 1} \cdot P + Q) \bmod 268,435円,456円$.

출력

Print a single line containing the answer. If the answer does not exist, just print 0ドル$.

제한

예제 입력 1

3 1 2
1 1 1

예제 출력 1

2

예제 입력 2

3 0 3
1 1 1

예제 출력 2

1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 8: DPRK Contest B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /