結果
問題 | No.2684 折々の色 |
ユーザー |
![]() |
提出日時 | 2024-03-25 10:25:32 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,791 bytes |
コンパイル時間 | 2,661 ms |
コンパイル使用メモリ | 78,164 KB |
実行使用メモリ | 39,636 KB |
最終ジャッジ日時 | 2024-09-30 14:00:54 |
合計ジャッジ時間 | 9,999 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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();Color.size = m;Color target = new Color();for (int i = 0; i < m; i++) {target.add(i, sc.nextInt() * 10000);}Color[] colors = new Color[n];for (int i = 0; i < n; i++) {colors[i] = new Color();for (int j = 0; j < m; j++) {colors[i].add(j, sc.nextInt());}colors[i].base = sc.nextInt();}for (int i = 0; i < n; i++) {for (int j = 0; j < n; j++) {if (i == j) {continue;}if (target.equals(colors[i].getColor(colors[j]))) {System.out.println("Yes");return;}}}System.out.println("No");}static class Color {static int size;int[] values = new int[size];int base;public void add(int idx, int v) {values[idx] = v;}public Color getColor(Color x) {Color ans = new Color();for (int i = 0; i < size; i++) {ans.add(i, values[i] * base * 100 + x.values[i] * (100 - base) * x.base);}return ans;}public boolean equals(Object o) {Color c = (Color)o;for (int i = 0; i < size; i++) {if (values[i] != c.values[i]) {return false;}}return true;}public String toString() {return Arrays.toString(values);}}}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();}}}