結果
| 問題 | No.2684 折々の色 | 
| コンテスト | |
| ユーザー |  momoyuu | 
| 提出日時 | 2024-10-10 00:13:30 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 697 ms / 2,000 ms | 
| コード長 | 1,429 bytes | 
| コンパイル時間 | 1,604 ms | 
| コンパイル使用メモリ | 120,712 KB | 
| 実行使用メモリ | 90,240 KB | 
| 最終ジャッジ日時 | 2024-10-10 00:13:53 | 
| 合計ジャッジ時間 | 23,084 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 56 | 
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
#include<map>
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    vector<ll> x(m);
    for(int i = 0;i<m;i++) cin>>x[i];
    vector<vector<ll>> c(n,vector<ll>(m));
    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];
    }
    map<vector<ll>,int> memo;
    vector<vector<ll>> w(n);
    for(int i = 0;i<n;i++){
        vector<ll> use(m);
        for(int j = 0;j<m;j++) use[j] = c[i][j] * t[i];
        memo[use]++;
        w[i] = use;
    }
    for(int i = 0;i<n;i++){
        vector<ll> want(m);
        if(t[i]==100){
            if(x==c[i]){
                cout<<"Yes\n";
                return 0;
            }
            continue;
        }
        bool fn = true;
        for(int j = 0;j<m;j++){
            want[j] = 10000 * x[j] - 100 * t[i] * c[i][j];
            ll now = 100 - t[i];
            if(now!=0){
                if(want[j]%now!=0) fn = false;
                else want[j] /= now;
            }
        }
        if(!fn) continue;
        bool ok = false;
        if(w[i]==want){
            if(memo[want]>=2) ok = 1;
        }else{
            if(memo[want]>=1) ok = 1;
        }
        if(ok) {
            cout<<"Yes\n";
            return 0;
        }
    }
    cout<<"No\n";
    return 0;
}
            
            
            
        