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

26249번 - Long Nim 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB78232027.027%

문제

Two players are playing famous game Nim. They are given $n$ heaps of stones, $i$-th of them contains $a_i$ stones. Two players alternate taking any positive number of stones from any single heap. The goal is to be the last to take a stone. It's obvious that this game has predetermined result in case both players are acting optimally. In this problem you should answer how long the game will last if losing player is trying to play as long as possible, but the winning player is trying to finish it as soon as possible without making any moves that could lead him to lose the game. You should also output one of the first possible turns of the first player, that leads to the described result.

입력

The first line of input contains a positive integer $n$ (1ドル\leq n\leq 10^5$).

The second line contains $n$ positive integers $a_i$ (1ドル\leq a_i\leq 10^{12}$) --- the sizes of heaps.

출력

In the first line output a positive integer --- how many turns the game will last if both players are playing optimally.

In the second line output the turn of the first player in format $i k,ドル where $i$ is the index of the heap and $k$ is the number of stones taken from the $i$-th heap. If there are multiple possible turns which lead to the optimal result, you may output any of them.

제한

예제 입력 1

2
1 3

예제 출력 1

3
2 2

예제 입력 2

2
2 2

예제 출력 2

4
1 1

힌트

출처

Contest > Open Cup > 2016/2017 Season > Stage 7: Grand Prix of Dolgoprudny D번

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

출처

대학교 대회

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

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