結果

問題 No.2684 折々の色
ユーザー tentententen
提出日時 2024-03-25 10:25:32
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 2,791 bytes
コンパイル時間 2,366 ms
コンパイル使用メモリ 78,664 KB
実行使用メモリ 81,760 KB
最終ジャッジ日時 2024-03-25 10:25:44
合計ジャッジ時間 9,932 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
53,980 KB
testcase_01 AC 50 ms
53,980 KB
testcase_02 AC 59 ms
54,116 KB
testcase_03 AC 53 ms
53,984 KB
testcase_04 AC 80 ms
56,816 KB
testcase_05 AC 55 ms
52,024 KB
testcase_06 AC 61 ms
54,104 KB
testcase_07 AC 53 ms
53,980 KB
testcase_08 AC 62 ms
54,104 KB
testcase_09 AC 56 ms
53,980 KB
testcase_10 AC 58 ms
53,996 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
        }
    }
    
}
0