結果

問題 No.2684 折々の色
ユーザー SnowBeenDiding
提出日時 2024-03-20 22:54:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,362 bytes
コンパイル時間 4,941 ms
コンパイル使用メモリ 320,528 KB
実行使用メモリ 53,152 KB
最終ジャッジ日時 2024-09-30 09:02:32
合計ジャッジ時間 29,620 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 43 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace std;
using namespace atcoder;

typedef long long ll;

ll make_hash(vector<ll> &v) {
    ll ret = 0;
    for (auto &x : v) {
        ret = ret * 1000000007 + x;
        ret %= 998244353;
    }
    return ret;
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<ll> x(w), t(h);
    rep(i, 0, w) cin >> x[i];
    vector<vector<ll>> c(h, vector<ll>(w));
    unordered_map<ll, int> ma;
    rep(i, 0, h) {
        rep(j, 0, w) cin >> c[i][j];
        cin >> t[i];
        c[i].push_back(t[i]);
        ma[make_hash(c[i])]++;
    }

    vector<ll> ret;
    auto f = [&](int ind, ll tt) {
        ret.clear();
        rep(j, 0, w) {
            ll q = 10000LL * x[j];
            q -= (100LL - tt) * t[ind] * c[ind][j];
            ll p = tt * 100;
            if (abs(q) % abs(p) != 0) return -1LL;
            ret.push_back(q / p);
        }
        ret.push_back(tt);
        return make_hash(ret);
    };

    rep(i, 0, h) {
        ma[make_hash(c[i])]--;
        rep(j, 1, 101) {
            ll hash = f(i, j);
            if (hash == -1) continue;
            if (ma[hash]) {
                cout << "Yes" << endl;
                return 0;
            }
        }
        ma[make_hash(c[i])]++;
    }

    cout << "No" << endl;
}
0