CF1332D.Walk on Matrix

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Bob is playing a game named "Walk on Matrix".

In this game, player is given an n×mn \times m matrix A=(ai,j)A=(a_{i,j}) , i.e. the element in the ii -th row in the jj -th column is ai,ja_{i,j} . Initially, player is located at position (1,1)(1,1) with score a1,1a_{1,1} .

To reach the goal, position (n,m)(n,m) , player can move right or down, i.e. move from (x,y)(x,y) to (x,y+1)(x,y+1) or (x+1,y)(x+1,y) , as long as player is still on the matrix.

However, each move changes player's score to the bitwise AND of the current score and the value at the position he moves to.

Bob can't wait to find out the maximum score he can get using the tool he recently learnt — dynamic programming. Here is his algorithm for this problem.

However, he suddenly realize that the algorithm above fails to output the maximum score for some matrix AA . Thus, for any given non-negative integer kk , he wants to find out an n×mn \times m matrix A=(ai,j)A=(a_{i,j}) such that

  • 1n,m5001 \le n,m \le 500 (as Bob hates large matrix);
  • 0ai,j31050 \le a_{i,j} \le 3 \cdot 10^5 for all 1in,1jm1 \le i\le n,1 \le j\le m (as Bob hates large numbers);
  • the difference between the maximum score he can get and the output of his algorithm is exactly kk .

It can be shown that for any given integer kk such that 0k1050 \le k \le 10^5 , there exists a matrix satisfying the above constraints.

Please help him with it!

输入格式

The only line of the input contains one single integer kk ( 0k1050 \le k \le 10^5 ).

输出格式

Output two integers nn , mm ( 1n,m5001 \le n,m \le 500 ) in the first line, representing the size of the matrix.

Then output nn lines with mm integers in each line, ai,ja_{i,j} in the (i+1)(i+1) -th row, jj -th column.

输入输出样例

  • 输入#1

    0

    输出#1

    1 1
    300000
  • 输入#2

    1

    输出#2

    3 4
    7 3 3 1
    4 8 3 6
    7 7 7 3

说明/提示

In the first example, the maximum score Bob can achieve is 300000300000 , while the output of his algorithm is 300000300000 .

In the second example, the maximum score Bob can achieve is 7&3&3&3&7&3=37\&3\&3\&3\&7\&3=3 , while the output of his algorithm is 22 .

首页