結果
問題 | No.474 色塗り2 |
ユーザー |
![]() |
提出日時 | 2016-12-21 19:07:57 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,193 bytes |
コンパイル時間 | 4,220 ms |
コンパイル使用メモリ | 90,812 KB |
実行使用メモリ | 68,636 KB |
最終ジャッジ日時 | 2024-12-14 14:23:24 |
合計ジャッジ時間 | 7,072 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 4 |
ソースコード
import java.util.*;import java.util.stream.Collectors;public class _474_Validator {public static void main(String[] args) {new _474_Validator().validate();}void validate() {try (final Scanner in = new Scanner(System.in)) {int T = parseInt(in.nextLine(), 1, 100000);while (T-- > 0) {int[] ABC = parseInts(in.nextLine(), 1, 1000000);}}}static int[] parseInts(String line, int min, int max) {int[] res = Arrays.stream(line.split(" ")).mapToInt(s -> {int val = Integer.parseInt(s);if (!s.matches("[1-9][0-9]*.*") || val < min || val > max) {throw new RuntimeException();}return val;}).toArray();String s = Arrays.stream(res).mapToObj(Integer::toString).collect(Collectors.joining(" "));if (!line.equals(s)) {throw new RuntimeException();}return res;}static int parseInt(String line, int min, int max) {int val = Integer.parseInt(line);if (!line.matches("[1-9][0-9]*.*") || val < min || val > max || !line.equals(Integer.toString(val))) {throw new RuntimeException();}return val;}// for debugstatic void dump(Object... o) {System.err.println(Arrays.deepToString(o));}}