結果

問題 No.2684 折々の色
ユーザー otoshigootoshigo
提出日時 2024-03-20 23:17:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 773 ms / 2,000 ms
コード長 1,499 bytes
コンパイル時間 961 ms
コンパイル使用メモリ 91,104 KB
実行使用メモリ 58,852 KB
最終ジャッジ日時 2024-03-20 23:17:37
合計ジャッジ時間 21,636 ms
ジャッジサーバーID
(参考情報)
judge15 / 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 2 ms
6,548 KB
testcase_11 AC 338 ms
28,928 KB
testcase_12 AC 241 ms
20,992 KB
testcase_13 AC 291 ms
33,456 KB
testcase_14 AC 121 ms
18,560 KB
testcase_15 AC 267 ms
24,320 KB
testcase_16 AC 41 ms
8,576 KB
testcase_17 AC 171 ms
19,200 KB
testcase_18 AC 345 ms
31,688 KB
testcase_19 AC 337 ms
34,560 KB
testcase_20 AC 205 ms
25,728 KB
testcase_21 AC 94 ms
11,136 KB
testcase_22 AC 527 ms
32,492 KB
testcase_23 AC 270 ms
26,240 KB
testcase_24 AC 140 ms
13,824 KB
testcase_25 AC 203 ms
18,560 KB
testcase_26 AC 383 ms
33,536 KB
testcase_27 AC 259 ms
22,656 KB
testcase_28 AC 277 ms
25,984 KB
testcase_29 AC 606 ms
57,544 KB
testcase_30 AC 546 ms
51,996 KB
testcase_31 AC 439 ms
52,476 KB
testcase_32 AC 707 ms
57,812 KB
testcase_33 AC 520 ms
58,416 KB
testcase_34 AC 606 ms
51,832 KB
testcase_35 AC 639 ms
52,244 KB
testcase_36 AC 469 ms
51,996 KB
testcase_37 AC 510 ms
52,460 KB
testcase_38 AC 755 ms
58,852 KB
testcase_39 AC 723 ms
58,852 KB
testcase_40 AC 729 ms
58,852 KB
testcase_41 AC 742 ms
58,852 KB
testcase_42 AC 747 ms
58,852 KB
testcase_43 AC 773 ms
58,852 KB
testcase_44 AC 734 ms
58,852 KB
testcase_45 AC 725 ms
58,852 KB
testcase_46 AC 754 ms
58,852 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 1 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<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin>>N>>M;
    vector<ll>X(M);
    for(int i=0;i<M;i++)cin>>X[i];
    vector C(N,vector<ll>(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];
    }
    for(int i=0;i<N;i++){
        if(T[i]==100){
            if(X==C[i]){
                cout<<"Yes\n";
                return 0;
            }
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<M;j++){
            C[i][j]*=T[i];
        }
    }
    multiset<vector<ll>>se;
    for(int i=0;i<N;i++)se.insert(C[i]);
    for(int i=0;i<N;i++){
        if(T[i]==100)continue;
        vector<ll>W(M);
        bool ok=true;
        for(int j=0;j<M;j++){
            if((10000*X[j]-100*C[i][j])%(100-T[i])!=0){
                ok=false;
                break;
            }
            W[j]=(10000*X[j]-100*C[i][j])/(100-T[i]);
        }
        se.erase(se.find(C[i]));
        if(ok&&se.count(W)){
            cout<<"Yes\n";
            return 0;
        }
        se.insert(C[i]);
    }
    cout<<"No\n";
}
0