結果

問題 No.2684 折々の色
ユーザー udon1206udon1206
提出日時 2024-03-20 21:48:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 794 ms / 2,000 ms
コード長 2,540 bytes
コンパイル時間 2,419 ms
コンパイル使用メモリ 215,352 KB
実行使用メモリ 59,624 KB
最終ジャッジ日時 2024-03-20 21:48:44
合計ジャッジ時間 21,856 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 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 3 ms
6,548 KB
testcase_11 AC 189 ms
28,032 KB
testcase_12 AC 97 ms
17,792 KB
testcase_13 AC 423 ms
34,100 KB
testcase_14 AC 172 ms
18,816 KB
testcase_15 AC 133 ms
22,016 KB
testcase_16 AC 21 ms
7,296 KB
testcase_17 AC 83 ms
15,744 KB
testcase_18 AC 408 ms
32,460 KB
testcase_19 AC 380 ms
35,072 KB
testcase_20 AC 231 ms
25,984 KB
testcase_21 AC 85 ms
11,264 KB
testcase_22 AC 540 ms
33,264 KB
testcase_23 AC 276 ms
26,624 KB
testcase_24 AC 135 ms
14,080 KB
testcase_25 AC 204 ms
18,816 KB
testcase_26 AC 397 ms
34,048 KB
testcase_27 AC 240 ms
23,040 KB
testcase_28 AC 271 ms
26,368 KB
testcase_29 AC 326 ms
46,156 KB
testcase_30 AC 280 ms
39,840 KB
testcase_31 AC 677 ms
53,248 KB
testcase_32 AC 412 ms
56,152 KB
testcase_33 AC 251 ms
38,580 KB
testcase_34 AC 322 ms
45,052 KB
testcase_35 AC 325 ms
44,568 KB
testcase_36 AC 645 ms
52,768 KB
testcase_37 AC 627 ms
53,232 KB
testcase_38 AC 794 ms
59,624 KB
testcase_39 AC 777 ms
59,624 KB
testcase_40 AC 779 ms
59,624 KB
testcase_41 AC 758 ms
59,624 KB
testcase_42 AC 763 ms
59,624 KB
testcase_43 AC 738 ms
59,624 KB
testcase_44 AC 768 ms
59,624 KB
testcase_45 AC 785 ms
59,624 KB
testcase_46 AC 779 ms
59,624 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 2 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 AC 2 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using ll = long long;
using std::cin;
using std::cout;
using std::endl;

std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

constexpr int inf = (int)1e9 + 7;
constexpr long long INF = 1LL << 60;

void solve()
{
    int n, m;
    cin >> n >> m;
    std::vector<ll> X(m);
    for (int i = 0; i < m; i++)
    {
        cin >> X[i];
        X[i] *= 10000;
    }
    std::vector C(n, std::vector<ll>(m));
    std::vector<ll> T(n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> C[i][j];
        }
        cin >> T[i];
    }

    for (int _ = 0; _ < 2; _++)
    {
        std::set<std::vector<ll>> s;
        std::vector<ll> v(m);
        for (int i = 0; i < n; i++)
        {
            bool ok = true;
            if (T[i] != 100)
            {
                for (int j = 0; j < m; j++)
                {
                    v[j] = X[j] - T[i] * 100 * C[i][j];
                    if (v[j] % (100 - T[i]) != 0)
                    {
                        ok = false;
                        break;
                    }
                    v[j] /= 100 - T[i];
                }
                if (ok and s.count(v))
                {
                    cout << "Yes"
                         << "\n";
                    return;
                }
            }
            else
            {
                bool ok = true;
                for (int j = 0; j < m; j++)
                {
                    if (C[i][j] * 10000 != X[j])
                    {
                        ok = false;
                        break;
                    }
                }
                if (ok)
                {
                    cout << "Yes"
                         << "\n";
                    return;
                }
            }

            for (int j = 0; j < m; j++)
            {
                v[j] = T[i] * C[i][j];
            }
            s.emplace(v);
        }
        std::reverse(T.begin(), T.end());
        std::reverse(C.begin(), C.end());
    }
    cout << "No"
         << "\n";
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    int kkt = 1;
    // cin >> kkt;
    while (kkt--)
    {
        solve();
    }
}
0