結果

問題 No.474 色塗り2
ユーザー tanzakutanzaku
提出日時 2016-12-21 19:08:27
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,201 bytes
コンパイル時間 4,725 ms
コンパイル使用メモリ 91,108 KB
実行使用メモリ 54,444 KB
最終ジャッジ日時 2024-05-08 11:02:09
合計ジャッジ時間 6,211 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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 || true) {
				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 debug
	static void dump(Object... o) {
		System.err.println(Arrays.deepToString(o));
	}
}
0