結果

問題 No.2684 折々の色
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-03-21 01:07:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,130 bytes
コンパイル時間 2,525 ms
コンパイル使用メモリ 214,956 KB
実行使用メモリ 43,156 KB
最終ジャッジ日時 2024-03-21 01:07:44
合計ジャッジ時間 31,726 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 1 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 RE -
testcase_12 AC 138 ms
16,896 KB
testcase_13 AC 629 ms
33,440 KB
testcase_14 AC 275 ms
17,408 KB
testcase_15 AC 185 ms
21,120 KB
testcase_16 AC 28 ms
7,808 KB
testcase_17 AC 115 ms
14,848 KB
testcase_18 AC 655 ms
37,448 KB
testcase_19 AC 629 ms
32,256 KB
testcase_20 AC 408 ms
19,456 KB
testcase_21 AC 127 ms
12,672 KB
testcase_22 AC 758 ms
38,508 KB
testcase_23 AC 451 ms
21,888 KB
testcase_24 AC 198 ms
15,872 KB
testcase_25 AC 326 ms
18,560 KB
testcase_26 AC 611 ms
27,776 KB
testcase_27 AC 377 ms
19,840 KB
testcase_28 AC 440 ms
21,632 KB
testcase_29 AC 459 ms
32,464 KB
testcase_30 AC 403 ms
31,200 KB
testcase_31 AC 1,127 ms
43,132 KB
testcase_32 AC 616 ms
40,612 KB
testcase_33 AC 330 ms
26,408 KB
testcase_34 AC 523 ms
35,912 KB
testcase_35 AC 476 ms
35,380 KB
testcase_36 AC 1,079 ms
42,720 KB
testcase_37 RE -
testcase_38 AC 1,380 ms
43,156 KB
testcase_39 AC 1,345 ms
43,156 KB
testcase_40 AC 1,313 ms
43,156 KB
testcase_41 RE -
testcase_42 RE -
testcase_43 AC 1,366 ms
43,156 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 1,314 ms
43,156 KB
testcase_47 AC 2 ms
6,548 KB
testcase_48 AC 2 ms
6,548 KB
testcase_49 AC 2 ms
6,548 KB
testcase_50 AC 2 ms
6,548 KB
testcase_51 AC 1 ms
6,548 KB
testcase_52 AC 2 ms
6,548 KB
testcase_53 AC 2 ms
6,548 KB
testcase_54 AC 2 ms
6,548 KB
testcase_55 AC 2 ms
6,548 KB
testcase_56 AC 2 ms
6,548 KB
testcase_57 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

int main() {
    fast_io();
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for (int i = 0; i < m; i++) {
        cin >> x[i];
    }
    vector<vector<int>> c(n, vector<int>(m));
    vector<int> t(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> c[i][j];
        }
        cin >> t[i];
    }
    set<array<pair<int, int>, 10>> st;
    for (int i = 0; i < n; i++) {
        array<pair<int, int>, 10> need;
        for (int j = 0; j < m; j++) {
            int a = 100 * x[j] - t[i] * c[i][j];
            int b = 100 - t[i];
            int g = gcd(a, b);
            if (a < 0) {
                a = -a;
                b = -b;
            }
            need[j] = {a / g, b / g};
        }
        if (st.count(need)) {
            cout << "Yes\n";
            return 0;
        }
        array<pair<int, int>, 10> data;
        for (int j = 0; j < m; j++) {
            int a = t[i] * c[i][j];
            int b = 100;
            int g = gcd(a, b);
            if (a < 0) {
                a = -a;
                b = -b;
            }
            data[j] = {a / g, b / g};
        }
        st.insert(data);
    }
    st.clear();
    for (int i = n - 1; i >= 0; i--) {
        array<pair<int, int>, 10> need;
        for (int j = 0; j < m; j++) {
            int a = 100 * x[j] - t[i] * c[i][j];
            int b = 100 - t[i];
            int g = gcd(a, b);
            if (a < 0) {
                a = -a;
                b = -b;
            }
            need[j] = {a / g, b / g};
        }
        if (st.count(need)) {
            cout << "Yes\n";
            return 0;
        }
        array<pair<int, int>, 10> data;
        for (int j = 0; j < m; j++) {
            int a = t[i] * c[i][j];
            int b = 100;
            int g = gcd(a, b);
            if (a < 0) {
                a = -a;
                b = -b;
            }
            data[j] = {a / g, b / g};
        }
        st.insert(data);
    }
    cout << "No\n";
}
0