結果

問題 No.2684 折々の色
ユーザー tnakao0123tnakao0123
提出日時 2024-04-26 15:36:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,758 bytes
コンパイル時間 995 ms
コンパイル使用メモリ 66,064 KB
実行使用メモリ 34,176 KB
最終ジャッジ日時 2024-04-26 15:37:16
合計ジャッジ時間 27,564 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
14,848 KB
testcase_01 AC 11 ms
14,720 KB
testcase_02 AC 12 ms
14,720 KB
testcase_03 AC 11 ms
14,720 KB
testcase_04 RE -
testcase_05 AC 12 ms
14,720 KB
testcase_06 AC 11 ms
14,720 KB
testcase_07 AC 11 ms
14,720 KB
testcase_08 RE -
testcase_09 AC 12 ms
14,720 KB
testcase_10 RE -
testcase_11 AC 222 ms
26,240 KB
testcase_12 AC 132 ms
21,120 KB
testcase_13 AC 200 ms
25,600 KB
testcase_14 AC 104 ms
21,504 KB
testcase_15 AC 123 ms
22,400 KB
testcase_16 AC 33 ms
16,896 KB
testcase_17 AC 99 ms
20,224 KB
testcase_18 AC 182 ms
27,008 KB
testcase_19 AC 224 ms
28,800 KB
testcase_20 AC 143 ms
22,528 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 361 ms
33,792 KB
testcase_30 AC 342 ms
33,920 KB
testcase_31 AC 366 ms
34,176 KB
testcase_32 AC 357 ms
33,920 KB
testcase_33 AC 366 ms
34,048 KB
testcase_34 AC 369 ms
33,920 KB
testcase_35 AC 344 ms
33,920 KB
testcase_36 AC 338 ms
33,920 KB
testcase_37 AC 346 ms
34,176 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 AC 12 ms
14,592 KB
testcase_48 AC 12 ms
14,592 KB
testcase_49 AC 12 ms
14,720 KB
testcase_50 AC 11 ms
14,720 KB
testcase_51 AC 11 ms
14,592 KB
testcase_52 AC 11 ms
14,592 KB
testcase_53 RE -
testcase_54 AC 11 ms
14,720 KB
testcase_55 AC 11 ms
14,720 KB
testcase_56 AC 11 ms
14,720 KB
testcase_57 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2684.cc:  No.2684 折々の色 - yukicoder
 */

#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int MAX_M = 10;

/* typedef */

typedef vector<int> vi;
typedef pair<vi,int> pvii;

/* global variables */

vi cvs[MAX_N];
int ts[MAX_N];
pvii ps[MAX_N];

/* subroutines */

void readv(int m, vi &v) {
  v.resize(m);
  for (int i = 0; i < m; i++) scanf("%d", &v[i]);
}

void subv(vi &a, vi &b) {
  for (int i = 0; i < a.size(); i++) a[i] -= b[i];
}

void mulv(vi &a, int b) { for (auto &u: a) u *= b; }

bool divv(vi &a, int b) {
  for (auto &u: a) {
    if (u % b != 0) return false;
    u /= b;
  }
  return true;
}

void printv(vi &a) { for (auto &u: a) printf(" %d", u); putchar('\n'); }

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  // ti/100*cik+(1-ti/100)*tj/100*cjk = xk
  // -> ti*cik+(1-ti/100)*tj*cjk = 100*xk
  // let ti*cik=>tcik,
  // -> tcik+(1-ti/100)tcjk = 100*xk
  // -> (1-ti/100)tcjk=100*xk-tcik
  // -> tcjk = (100*xk-tcik)*100/(100-ti)

  vi xv;
  readv(m, xv);
  mulv(xv, 100);

  for (int i = 0; i < n; i++) {
    readv(m, cvs[i]);
    scanf("%d", ts + i);
    mulv(cvs[i], ts[i]);
    ps[i] = {cvs[i], ts[i]};
  }
  sort(ps, ps + n);

  for (int i = 0; i < n; i++) {
    cvs[i] = ps[i].first, ts[i] = ps[i].second;
    //printv(cvs[i]);
  }
  
  for (int i = 0; i < n; i++) {
    vi fv(xv.begin(), xv.end());
    subv(fv, cvs[i]);
    mulv(fv, 100);
    if (divv(fv, 100 - ts[i])) {
      //printf(" i=%d:", i); printv(fv);
      int k = lower_bound(cvs, cvs + n, fv) - cvs;
      if (k < n && i != k && fv == cvs[k]) {
	puts("Yes"); return 0;
      }
    }
  }

  puts("No");
  return 0;
}
0