結果

問題 No.2684 折々の色
ユーザー ks2mks2m
提出日時 2024-03-20 22:24:24
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,865 bytes
コンパイル時間 2,981 ms
コンパイル使用メモリ 78,264 KB
実行使用メモリ 140,708 KB
最終ジャッジ日時 2024-03-20 22:25:23
合計ジャッジ時間 52,606 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,976 KB
testcase_01 AC 53 ms
54,036 KB
testcase_02 AC 62 ms
54,120 KB
testcase_03 AC 56 ms
53,984 KB
testcase_04 AC 59 ms
53,996 KB
testcase_05 AC 53 ms
54,008 KB
testcase_06 AC 60 ms
53,988 KB
testcase_07 AC 56 ms
53,984 KB
testcase_08 AC 58 ms
51,920 KB
testcase_09 AC 55 ms
51,908 KB
testcase_10 AC 57 ms
53,996 KB
testcase_11 AC 977 ms
94,988 KB
testcase_12 AC 767 ms
82,016 KB
testcase_13 AC 987 ms
101,644 KB
testcase_14 AC 766 ms
81,220 KB
testcase_15 AC 850 ms
83,536 KB
testcase_16 AC 299 ms
65,700 KB
testcase_17 AC 698 ms
79,840 KB
testcase_18 AC 1,007 ms
97,992 KB
testcase_19 AC 1,085 ms
98,472 KB
testcase_20 AC 950 ms
82,600 KB
testcase_21 AC 404 ms
67,876 KB
testcase_22 AC 1,062 ms
101,208 KB
testcase_23 AC 945 ms
86,460 KB
testcase_24 AC 589 ms
70,216 KB
testcase_25 AC 745 ms
78,964 KB
testcase_26 AC 1,170 ms
102,284 KB
testcase_27 AC 739 ms
82,632 KB
testcase_28 AC 994 ms
92,224 KB
testcase_29 AC 1,658 ms
122,952 KB
testcase_30 AC 1,381 ms
121,432 KB
testcase_31 AC 1,383 ms
117,044 KB
testcase_32 AC 1,636 ms
134,208 KB
testcase_33 AC 1,625 ms
125,420 KB
testcase_34 AC 1,434 ms
121,276 KB
testcase_35 AC 1,475 ms
131,920 KB
testcase_36 AC 1,452 ms
116,004 KB
testcase_37 AC 1,364 ms
117,648 KB
testcase_38 AC 1,617 ms
136,828 KB
testcase_39 AC 1,670 ms
139,144 KB
testcase_40 AC 1,717 ms
138,416 KB
testcase_41 AC 1,734 ms
140,708 KB
testcase_42 AC 1,698 ms
137,092 KB
testcase_43 AC 1,575 ms
134,460 KB
testcase_44 AC 1,547 ms
136,832 KB
testcase_45 AC 1,607 ms
138,652 KB
testcase_46 AC 1,645 ms
136,992 KB
testcase_47 AC 55 ms
53,972 KB
testcase_48 AC 56 ms
53,976 KB
testcase_49 AC 55 ms
54,004 KB
testcase_50 AC 55 ms
53,988 KB
testcase_51 AC 55 ms
54,008 KB
testcase_52 AC 55 ms
53,984 KB
testcase_53 AC 56 ms
54,016 KB
testcase_54 AC 55 ms
53,992 KB
testcase_55 AC 56 ms
53,992 KB
testcase_56 AC 52 ms
53,992 KB
testcase_57 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

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 m = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] x = new int[m];
		for (int i = 0; i < m; i++) {
			x[i] = Integer.parseInt(sa[i]) * 10000;
		}
		int[][] c = new int[n][m];
		int[] t = new int[n];
		for (int i = 0; i < n; i++) {
			sa = br.readLine().split(" ");
			for (int j = 0; j < m; j++) {
				c[i][j] = Integer.parseInt(sa[j]);
			}
			t[i] = Integer.parseInt(sa[m]);
		}
		br.close();

		String[] keys = new String[n];
		Map<String, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < m; j++) {
				sb.append(t[i] * c[i][j]).append('-');
			}
			String s = sb.toString();
			keys[i] = s;
			map.put(s, map.getOrDefault(s, 0) + 1);
		}

		for (int i = 0; i < n; i++) {
			boolean flg = true;
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < m; j++) {
				int v1 = x[j] - 100 * t[i] * c[i][j];
				int v2 = 100 - t[i];
				if (v2 == 0) {
					if (v1 != 0) {
						flg = false;
						break;
					}
				}
				if (v1 % v2 != 0) {
					flg = false;
					break;
				}
				sb.append(v1 / v2).append('-');
			}
			if (flg) {
				if (t[i] == 100) {
					System.out.println("Yes");
					return;
				}
				String s = sb.toString();
				if (s.equals(keys[i])) {
					if (map.getOrDefault(s, 0) >= 2) {
						System.out.println("Yes");
						return;
					}
				} else {
					if (map.containsKey(s)) {
						System.out.println("Yes");
						return;
					}
				}
			}
		}
		System.out.println("No");
	}
}
0