結果
問題 | No.1149 色塗りゲーム |
ユーザー |
|
提出日時 | 2020-08-07 22:05:34 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 275 ms / 2,000 ms |
コード長 | 1,257 bytes |
コンパイル時間 | 2,351 ms |
コンパイル使用メモリ | 79,148 KB |
実行使用メモリ | 70,856 KB |
平均クエリ数 | 19.82 |
最終ジャッジ日時 | 2024-07-17 04:43:38 |
合計ジャッジ時間 | 15,333 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
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();}}