結果
問題 | No.2684 折々の色 |
ユーザー |
![]() |
提出日時 | 2024-03-25 10:43:34 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,090 bytes |
コンパイル時間 | 2,475 ms |
コンパイル使用メモリ | 78,440 KB |
実行使用メモリ | 60,544 KB |
最終ジャッジ日時 | 2024-09-30 14:01:10 |
合計ジャッジ時間 | 8,569 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 TLE * 1 -- * 46 |
ソースコード
import java.io.*;import java.util.*;import java.util.function.*;import java.util.stream.*;public class Main {public static void main(String[] args) throws Exception {Scanner sc = new Scanner();int n = sc.nextInt();int m = sc.nextInt();int[] target = new int[m];for (int i = 0; i < m; i++) {target[i] = sc.nextInt();}int[][] colors = new int[n][m];int[] base = new int[n];for (int i = 0; i < n; i++) {for (int j = 0; j < m; j++) {colors[i][j] = sc.nextInt();}base[i] = sc.nextInt();}for (int i = 0; i < n; i++) {for (int j = 0; j < n; j++) {if (i == j) {continue;}boolean enable = true;for (int k = 0; k < m && enable; k++) {enable = (target[k] * 10000 == colors[i][k] * base[i] * 100 + colors[j][k] * (100 - base[i]) * base[j]);}if (enable) {System.out.println("Yes");return;}}}System.out.println("No");}}class Scanner {BufferedReader br;StringTokenizer st = new StringTokenizer("");StringBuilder sb = new StringBuilder();public Scanner() {try {br = new BufferedReader(new InputStreamReader(System.in));} catch (Exception e) {}}public int nextInt() {return Integer.parseInt(next());}public long nextLong() {return Long.parseLong(next());}public double nextDouble() {return Double.parseDouble(next());}public String next() {try {while (!st.hasMoreTokens()) {st = new StringTokenizer(br.readLine());}} catch (Exception e) {e.printStackTrace();} finally {return st.nextToken();}}}