結果

問題 No.2684 折々の色
ユーザー GOTKAKO
提出日時 2024-03-20 22:55:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,141 bytes
コンパイル時間 2,276 ms
コンパイル使用メモリ 206,096 KB
最終ジャッジ日時 2025-02-20 09:54:15
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 55 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N,M; cin >> N >> M;
    vector<int> X(M),T(N);
    vector<vector<int>> C(N);
    for(auto &x : X) cin >> x,x *= 10000;


    set<vector<int>> S;
    for(int i=0; i<N; i++){
        vector<int> now(M);
        for(auto &n : now) cin >> n;
        int t; cin >> t;
        for(auto &n : now) n *= t;
        S.insert(now);
        C.at(i) = now; T.at(i) = t;
    }

    bool yes = false;
    for(int i=0; i<N; i++){
        vector<int> goal = X;
        bool ok = true;
        int t = T.at(i);
        for(int k=0; k<M; k++){
            goal.at(k) -= 100*C.at(i).at(k);
            if(t == 100){if(goal.at(k) != 0){ok = false; break;}}
            else if(goal.at(k) >= 0){
                if(goal.at(k)%(100-t)){ok = false; break;}
                goal.at(k) /= 100-t;
            }
            else{ok = false; break;}
        } 
        if(t == 100){if(ok){yes = true; break;}}
        else if(S.count(goal) && ok){yes = true; break;}
    }
    if(yes) cout << "Yes" << endl;
    else cout << "No" << endl;

}
0