結果
問題 | No.2684 折々の色 |
ユーザー |
|
提出日時 | 2024-03-20 21:17:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,041 ms / 2,000 ms |
コード長 | 1,599 bytes |
コンパイル時間 | 3,155 ms |
コンパイル使用メモリ | 224,724 KB |
最終ジャッジ日時 | 2025-02-20 08:34:00 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 56 |
ソースコード
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } inline double time() { return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9; } 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]; x[i] *= 10000; } set<vector<ll>> st[101]; vector<vector<ll>> b(n); vector<ll> t(n); for (int i = 0; i < n; ++i) { vector<ll> a(m); for (int j = 0; j < m; ++j) { cin >> a[j]; } b[i] = a; cin >> t[i]; st[t[i]].insert(a); } vector<ll> target(m); for (int j = 0; j < n; ++j) { for (int ti = 1; ti <= 100; ++ti) { bool ok = true; for (int i = 0; i < m; ++i) { target[i] = x[i] - (100LL - ti) * t[j] * b[j][i]; if (target[i]%(100*ti)) { ok = false; break; } else { target[i] /= (100*ti); } } if (!ok) continue; if (st[ti].find(target) != st[ti].end() and target != b[j]) { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; }