結果

問題 No.2684 折々の色
ユーザー SSRSSSRS
提出日時 2024-03-20 21:26:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 737 ms / 2,000 ms
コード長 1,397 bytes
コンパイル時間 2,666 ms
コンパイル使用メモリ 218,636 KB
実行使用メモリ 33,832 KB
最終ジャッジ日時 2024-03-20 21:27:08
合計ジャッジ時間 23,655 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 3 ms
6,548 KB
testcase_02 AC 3 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 3 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 3 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 3 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 3 ms
6,548 KB
testcase_11 AC 321 ms
21,436 KB
testcase_12 AC 207 ms
14,980 KB
testcase_13 AC 361 ms
23,152 KB
testcase_14 AC 186 ms
14,080 KB
testcase_15 AC 202 ms
17,228 KB
testcase_16 AC 42 ms
7,424 KB
testcase_17 AC 184 ms
13,824 KB
testcase_18 AC 285 ms
25,844 KB
testcase_19 AC 401 ms
25,528 KB
testcase_20 AC 280 ms
15,616 KB
testcase_21 AC 64 ms
9,472 KB
testcase_22 AC 290 ms
26,468 KB
testcase_23 AC 271 ms
17,536 KB
testcase_24 AC 111 ms
11,648 KB
testcase_25 AC 167 ms
13,312 KB
testcase_26 AC 387 ms
22,040 KB
testcase_27 AC 206 ms
14,208 KB
testcase_28 AC 270 ms
17,408 KB
testcase_29 AC 694 ms
33,088 KB
testcase_30 AC 667 ms
33,360 KB
testcase_31 AC 648 ms
33,772 KB
testcase_32 AC 692 ms
33,244 KB
testcase_33 AC 721 ms
33,624 KB
testcase_34 AC 665 ms
33,308 KB
testcase_35 AC 641 ms
33,640 KB
testcase_36 AC 684 ms
33,360 KB
testcase_37 AC 654 ms
33,760 KB
testcase_38 AC 734 ms
33,832 KB
testcase_39 AC 705 ms
33,832 KB
testcase_40 AC 710 ms
33,832 KB
testcase_41 AC 736 ms
33,832 KB
testcase_42 AC 706 ms
33,832 KB
testcase_43 AC 708 ms
33,832 KB
testcase_44 AC 737 ms
33,832 KB
testcase_45 AC 708 ms
33,832 KB
testcase_46 AC 735 ms
33,832 KB
testcase_47 AC 2 ms
6,548 KB
testcase_48 AC 3 ms
6,548 KB
testcase_49 AC 2 ms
6,548 KB
testcase_50 AC 2 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 3 ms
6,548 KB
testcase_55 AC 3 ms
6,548 KB
testcase_56 AC 2 ms
6,548 KB
testcase_57 AC 2 ms
6,548 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>> C(N, vector<int>(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];
  }
  vector<pair<vector<int>, int>> P(N);
  for (int i = 0; i < N; i++){
    P[i].first.resize(M);
    for (int j = 0; j < M; j++){
      P[i].first[j] = T[i] * C[i][j];
    }
    P[i].second = i;
  }
  sort(P.begin(), P.end());
  bool ok = false;
  for (int i = 0; i < N; i++){
    if (T[i] == 100){
      if (X == C[i]){
        ok = true;
      }
    } else {
      vector<int> R(M);
      bool ok2 = true;
      for (int j = 0; j < M; j++){
        R[j] = 10000 * X[j] - 100 * T[i] * C[i][j];
        if (R[j] % (100 - T[i]) != 0){
          ok2 = false;
        }
        R[j] /= 100 - T[i];
      }
      if (ok2){
        int p = lower_bound(P.begin(), P.end(), make_pair(R, -1)) - P.begin();
        if (p < N){
          if (P[p].first == R){
            if (P[p].second != i){
              ok = true;
            } else if (p < N - 1){
              if (P[p + 1].first == R){
                ok = true;
              }
            }
          }
        }
      }
    }
  }
  if (ok){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
0