結果

問題 No.690 E869120 and Constructing Array 4
ユーザー GrenacheGrenache
提出日時 2018-05-19 12:00:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,096 bytes
コンパイル時間 4,195 ms
コンパイル使用メモリ 76,168 KB
実行使用メモリ 56,176 KB
最終ジャッジ日時 2023-09-10 23:40:30
合計ジャッジ時間 9,352 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
55,576 KB
testcase_01 AC 164 ms
55,988 KB
testcase_02 AC 163 ms
55,760 KB
testcase_03 AC 165 ms
55,704 KB
testcase_04 AC 163 ms
55,916 KB
testcase_05 AC 166 ms
56,176 KB
testcase_06 AC 151 ms
55,804 KB
testcase_07 AC 151 ms
55,816 KB
testcase_08 AC 162 ms
55,700 KB
testcase_09 AC 164 ms
55,932 KB
testcase_10 AC 156 ms
55,924 KB
testcase_11 AC 163 ms
56,064 KB
testcase_12 AC 164 ms
55,832 KB
testcase_13 AC 164 ms
55,768 KB
testcase_14 AC 161 ms
55,716 KB
testcase_15 AC 160 ms
56,008 KB
testcase_16 AC 160 ms
55,772 KB
testcase_17 AC 150 ms
55,992 KB
testcase_18 WA -
testcase_19 AC 163 ms
56,172 KB
testcase_20 AC 160 ms
55,680 KB
testcase_21 AC 161 ms
56,008 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("1 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