結果

問題 No.690 E869120 and Constructing Array 4
ユーザー GrenacheGrenache
提出日時 2018-05-19 12:03:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 167 ms / 1,000 ms
コード長 1,096 bytes
コンパイル時間 6,968 ms
コンパイル使用メモリ 76,544 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2023-09-10 23:40:43
合計ジャッジ時間 8,724 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
56,012 KB
testcase_01 AC 163 ms
56,100 KB
testcase_02 AC 163 ms
55,876 KB
testcase_03 AC 151 ms
56,472 KB
testcase_04 AC 162 ms
56,144 KB
testcase_05 AC 161 ms
55,764 KB
testcase_06 AC 162 ms
55,936 KB
testcase_07 AC 154 ms
56,352 KB
testcase_08 AC 160 ms
55,928 KB
testcase_09 AC 163 ms
56,084 KB
testcase_10 AC 151 ms
55,592 KB
testcase_11 AC 161 ms
55,780 KB
testcase_12 AC 163 ms
56,112 KB
testcase_13 AC 152 ms
56,024 KB
testcase_14 AC 153 ms
56,124 KB
testcase_15 AC 163 ms
55,820 KB
testcase_16 AC 167 ms
56,256 KB
testcase_17 AC 156 ms
55,880 KB
testcase_18 AC 125 ms
55,760 KB
testcase_19 AC 150 ms
56,424 KB
testcase_20 AC 161 ms
56,080 KB
testcase_21 AC 163 ms
55,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder690 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int k = sc.nextInt();

		if (k == 0) {
			pr.println("2 0");

			return;
		}

		int n = 32;
		List<Integer> d1 = new ArrayList<>();
		List<Integer> d2 = new ArrayList<>();
		for (int i = 1; i < n - 1; i++) {
			for (int j = 0; j < i; j++) {
				d1.add(j);
				d2.add(i);
			}

			if ((k & 0x1 << (i - 1)) != 0) {
				d1.add(i);
				d2.add(n - 1);
			}
		}

		pr.printf("%d %d\n", n, d1.size());
		for (int i = 0, size = d1.size(); i < size; i++) {
			pr.printf("%d %d\n", d1.get(i) + 1, d2.get(i) + 1);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0