結果

問題 No.2684 折々の色
ユーザー AyunaAyuna
提出日時 2023-12-15 23:33:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 859 ms / 2,000 ms
コード長 1,146 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 182,308 KB
実行使用メモリ 45,508 KB
最終ジャッジ日時 2024-03-07 02:20:35
合計ジャッジ時間 25,847 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 429 ms
26,624 KB
testcase_12 AC 243 ms
19,200 KB
testcase_13 AC 422 ms
30,216 KB
testcase_14 AC 213 ms
17,152 KB
testcase_15 AC 270 ms
22,144 KB
testcase_16 AC 53 ms
8,960 KB
testcase_17 AC 214 ms
17,408 KB
testcase_18 AC 398 ms
33,840 KB
testcase_19 AC 458 ms
31,744 KB
testcase_20 AC 312 ms
20,352 KB
testcase_21 AC 83 ms
11,648 KB
testcase_22 AC 429 ms
34,644 KB
testcase_23 AC 333 ms
21,504 KB
testcase_24 AC 135 ms
14,592 KB
testcase_25 AC 212 ms
16,896 KB
testcase_26 AC 435 ms
27,264 KB
testcase_27 AC 254 ms
19,456 KB
testcase_28 AC 316 ms
21,376 KB
testcase_29 AC 813 ms
44,600 KB
testcase_30 AC 764 ms
41,928 KB
testcase_31 AC 769 ms
42,340 KB
testcase_32 AC 808 ms
44,828 KB
testcase_33 AC 852 ms
45,248 KB
testcase_34 AC 755 ms
41,776 KB
testcase_35 AC 785 ms
42,140 KB
testcase_36 AC 804 ms
41,928 KB
testcase_37 AC 791 ms
42,328 KB
testcase_38 AC 840 ms
45,508 KB
testcase_39 AC 829 ms
45,508 KB
testcase_40 AC 838 ms
45,508 KB
testcase_41 AC 830 ms
45,508 KB
testcase_42 AC 840 ms
45,508 KB
testcase_43 AC 842 ms
45,508 KB
testcase_44 AC 859 ms
45,508 KB
testcase_45 AC 848 ms
45,508 KB
testcase_46 AC 833 ms
45,508 KB
testcase_47 AC 2 ms
6,676 KB
testcase_48 AC 2 ms
6,676 KB
testcase_49 AC 2 ms
6,676 KB
testcase_50 AC 2 ms
6,676 KB
testcase_51 AC 2 ms
6,676 KB
testcase_52 AC 2 ms
6,676 KB
testcase_53 AC 2 ms
6,676 KB
testcase_54 AC 1 ms
6,676 KB
testcase_55 AC 2 ms
6,676 KB
testcase_56 AC 2 ms
6,676 KB
testcase_57 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  for (int i = 0; i < m; i++) cin >> x[i];
  vector<vector<int>> a(n, vector<int>(m + 1));
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= m; j++) cin >> a[i][j];
  map<vector<int>, int> mp;
  for (int i = 0; i < n; i++) {
    vector<int> list(m);
    for (int j = 0; j < m; j++) list[j] = a[i][j] * a[i][m];
    if (mp.find(list) == mp.end())
      mp[list] = i;
    else
      mp[list] = -1;
  }
  for (int i = 0; i < n; i++) {
    if (a[i][m] == 100) {
      vector<int> check = a[i];
      check.pop_back();
      if (check == x) {
        cout << "Yes" << endl;
        return 0;
      }
      continue;
    }
    bool flg = true;
    vector<int> predict;
    for (int j = 0; j < m; j++) {
      int k = x[j] * 10000 - 100 * a[i][m] * a[i][j];
      if (k % (100 - a[i][m]) != 0) {
        flg = false;
        break;
      }
      predict.push_back(k / (100 - a[i][m]));
    }
    if (flg && mp.find(predict) != mp.end() && mp[predict] != i) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}
0