結果

問題 No.862 XORでX
ユーザー ks2mks2m
提出日時 2019-08-09 22:49:46
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,143 bytes
コンパイル時間 5,002 ms
コンパイル使用メモリ 73,280 KB
実行使用メモリ 64,324 KB
最終ジャッジ日時 2023-09-26 21:10:13
合計ジャッジ時間 16,236 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,204 KB
testcase_01 AC 43 ms
49,476 KB
testcase_02 AC 42 ms
49,360 KB
testcase_03 AC 43 ms
49,296 KB
testcase_04 AC 45 ms
49,320 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 180 ms
54,168 KB
testcase_09 AC 183 ms
54,500 KB
testcase_10 AC 179 ms
53,956 KB
testcase_11 AC 179 ms
53,776 KB
testcase_12 AC 45 ms
49,124 KB
testcase_13 AC 44 ms
49,860 KB
testcase_14 AC 43 ms
49,348 KB
testcase_15 AC 42 ms
49,316 KB
testcase_16 WA -
testcase_17 AC 435 ms
61,992 KB
testcase_18 AC 428 ms
62,240 KB
testcase_19 AC 434 ms
61,948 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 519 ms
62,416 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 515 ms
62,380 KB
testcase_31 AC 516 ms
62,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int x = Integer.parseInt(sa[1]);
		br.close();

		int n4 = n % 4;
		if (n4 == 0) n4 = 4;
		int x4 = x % 4;
		int l = x - x4;
		int r = x - x4 + 4;
		int end = n - n4 + 4;
		if (4 <= x && x < 8) end += 4;

		for (int i = 4; i < end; i++) {
			if (l <= i && i < r) {
				continue;
			}
			System.out.println(i);
		}

		switch (n4) {
		case 1:
			System.out.println(x);
			break;
		case 2:
			System.out.println(x % 2 == 0 ? x + 1 : x - 1);
			System.out.println(1);
			break;
		case 3:
			System.out.println(x % 2 == 0 ? x + 1 : x - 1);
			System.out.println(2);
			System.out.println(3);
			break;
		default:
			System.out.println(x);
			System.out.println(1);
			if (x4 < 2) {
				System.out.println(x - x4 + 2);
				System.out.println(x - x4 + 3);
			} else {
				System.out.println(x - x4);
				System.out.println(x - x4 + 1);
			}
		}
	}
}
0