結果

問題 No.1149 色塗りゲーム
ユーザー KinaKina
提出日時 2020-08-07 22:05:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 1,257 bytes
コンパイル時間 2,647 ms
コンパイル使用メモリ 79,892 KB
実行使用メモリ 73,764 KB
平均クエリ数 19.82
最終ジャッジ日時 2023-09-24 04:30:43
合計ジャッジ時間 14,606 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
71,288 KB
testcase_01 AC 140 ms
69,244 KB
testcase_02 AC 142 ms
68,772 KB
testcase_03 AC 142 ms
69,040 KB
testcase_04 AC 143 ms
68,736 KB
testcase_05 AC 169 ms
71,204 KB
testcase_06 AC 164 ms
71,152 KB
testcase_07 AC 161 ms
69,248 KB
testcase_08 AC 174 ms
71,312 KB
testcase_09 AC 150 ms
69,336 KB
testcase_10 AC 152 ms
69,060 KB
testcase_11 AC 156 ms
69,232 KB
testcase_12 AC 176 ms
71,900 KB
testcase_13 AC 153 ms
69,004 KB
testcase_14 AC 173 ms
72,076 KB
testcase_15 AC 155 ms
68,924 KB
testcase_16 AC 151 ms
67,464 KB
testcase_17 AC 155 ms
69,116 KB
testcase_18 AC 168 ms
71,976 KB
testcase_19 AC 154 ms
69,512 KB
testcase_20 AC 172 ms
71,180 KB
testcase_21 AC 160 ms
71,084 KB
testcase_22 AC 163 ms
70,952 KB
testcase_23 AC 169 ms
71,384 KB
testcase_24 AC 156 ms
69,484 KB
testcase_25 AC 159 ms
69,308 KB
testcase_26 AC 172 ms
71,844 KB
testcase_27 AC 162 ms
69,436 KB
testcase_28 AC 174 ms
71,560 KB
testcase_29 AC 172 ms
71,308 KB
testcase_30 AC 221 ms
71,944 KB
testcase_31 AC 209 ms
71,832 KB
testcase_32 AC 211 ms
71,372 KB
testcase_33 AC 202 ms
69,016 KB
testcase_34 AC 226 ms
73,764 KB
testcase_35 AC 198 ms
69,588 KB
testcase_36 AC 213 ms
69,636 KB
testcase_37 AC 231 ms
71,896 KB
testcase_38 AC 203 ms
69,492 KB
testcase_39 AC 233 ms
73,412 KB
testcase_40 AC 234 ms
71,792 KB
testcase_41 AC 221 ms
69,056 KB
testcase_42 AC 232 ms
71,904 KB
testcase_43 AC 217 ms
69,816 KB
testcase_44 AC 240 ms
72,176 KB
testcase_45 AC 228 ms
69,560 KB
testcase_46 AC 222 ms
69,408 KB
testcase_47 AC 228 ms
69,724 KB
testcase_48 AC 248 ms
72,372 KB
testcase_49 AC 237 ms
67,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

final class Solver {
	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		var grid = new BitSet(N + 1);
		{
			var start = -Math.floorDiv(-N, 2);
			grid.set(start);
			if (N % 2 == 0) grid.set(start + 1);
			System.out.printf("%d %d%n", grid.cardinality(), grid.nextSetBit(0));
		}
		while (true) {
			int t = Integer.parseInt(sc.get());
			if (t != 3) {
				return;
			}
			int k = Integer.parseInt(sc.get());
			int x = Integer.parseInt(sc.get());
			grid.set(x, x + k - 1);

			var start = N - x  + 1 - (k - 1);
			grid.set(start);
			if (k == 2) grid.set(start + 1);
			System.out.printf("%d %d%n", k, start);
		}
	}
}

class Main {
	public static void main(String... args) {
//		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		new Solver().solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
//		System.out.flush();
	}
}
0