結果
問題 | No.2684 折々の色 |
ユーザー | shinchan |
提出日時 | 2024-03-20 22:33:14 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 654 ms / 2,000 ms |
コード長 | 4,732 bytes |
コンパイル時間 | 2,598 ms |
コンパイル使用メモリ | 213,612 KB |
実行使用メモリ | 59,520 KB |
最終ジャッジ日時 | 2024-09-30 08:37:08 |
合計ジャッジ時間 | 17,919 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 151 ms
28,160 KB |
testcase_12 | AC | 84 ms
17,792 KB |
testcase_13 | AC | 313 ms
34,048 KB |
testcase_14 | AC | 131 ms
18,816 KB |
testcase_15 | AC | 96 ms
22,016 KB |
testcase_16 | AC | 18 ms
7,296 KB |
testcase_17 | AC | 79 ms
15,872 KB |
testcase_18 | AC | 291 ms
32,436 KB |
testcase_19 | AC | 287 ms
35,200 KB |
testcase_20 | AC | 177 ms
25,984 KB |
testcase_21 | AC | 69 ms
11,136 KB |
testcase_22 | AC | 392 ms
33,056 KB |
testcase_23 | AC | 221 ms
26,496 KB |
testcase_24 | AC | 104 ms
13,824 KB |
testcase_25 | AC | 153 ms
18,688 KB |
testcase_26 | AC | 309 ms
33,920 KB |
testcase_27 | AC | 189 ms
22,912 KB |
testcase_28 | AC | 211 ms
26,112 KB |
testcase_29 | AC | 262 ms
46,080 KB |
testcase_30 | AC | 224 ms
39,808 KB |
testcase_31 | AC | 534 ms
53,264 KB |
testcase_32 | AC | 316 ms
56,244 KB |
testcase_33 | AC | 212 ms
38,480 KB |
testcase_34 | AC | 256 ms
45,056 KB |
testcase_35 | AC | 251 ms
44,656 KB |
testcase_36 | AC | 493 ms
52,736 KB |
testcase_37 | AC | 459 ms
53,248 KB |
testcase_38 | AC | 625 ms
59,392 KB |
testcase_39 | AC | 635 ms
59,392 KB |
testcase_40 | AC | 645 ms
59,468 KB |
testcase_41 | AC | 632 ms
59,500 KB |
testcase_42 | AC | 635 ms
59,496 KB |
testcase_43 | AC | 630 ms
59,516 KB |
testcase_44 | AC | 654 ms
59,460 KB |
testcase_45 | AC | 618 ms
59,520 KB |
testcase_46 | AC | 626 ms
59,520 KB |
testcase_47 | AC | 2 ms
5,248 KB |
testcase_48 | AC | 2 ms
5,248 KB |
testcase_49 | AC | 2 ms
5,248 KB |
testcase_50 | AC | 2 ms
5,248 KB |
testcase_51 | AC | 2 ms
5,248 KB |
testcase_52 | AC | 1 ms
5,248 KB |
testcase_53 | AC | 1 ms
5,248 KB |
testcase_54 | AC | 2 ms
5,248 KB |
testcase_55 | AC | 2 ms
5,248 KB |
testcase_56 | AC | 2 ms
5,248 KB |
testcase_57 | AC | 2 ms
5,248 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define all(v) (v).begin(),(v).end() #define pb(a) push_back(a) #define rep(i, n) for(int i=0;i<n;i++) #define foa(e, v) for(auto&& e : v) using ll = long long; const ll MOD7 = 1000000007, MOD998 = 998244353, INF = (1LL << 60); #define dout(a) cout<<fixed<<setprecision(10)<<a<<endl; template<int MOD> struct Modint { long long val; constexpr Modint(long long v = 0) noexcept : val(v % MOD) { if (val < 0) val += MOD; } constexpr int mod() const { return MOD; } constexpr long long value() const { return val; } constexpr Modint operator - () const noexcept { return val ? MOD - val : 0; } constexpr Modint operator + (const Modint& r) const noexcept { return Modint(*this) += r; } constexpr Modint operator - (const Modint& r) const noexcept { return Modint(*this) -= r; } constexpr Modint operator * (const Modint& r) const noexcept { return Modint(*this) *= r; } constexpr Modint operator / (const Modint& r) const noexcept { return Modint(*this) /= r; } constexpr Modint& operator += (const Modint& r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Modint& operator -= (const Modint& r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Modint& operator *= (const Modint& r) noexcept { val = val * r.val % MOD; return *this; } constexpr Modint& operator /= (const Modint& r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b, swap(a, b); u -= t * v, swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator == (const Modint& r) const noexcept { return this->val == r.val; } constexpr bool operator != (const Modint& r) const noexcept { return this->val != r.val; } friend constexpr istream& operator >> (istream& is, Modint<MOD>& x) noexcept { is >> x.val; x.val %= MOD; if (x.val < 0) x.val += MOD; return is; } friend constexpr ostream& operator << (ostream& os, const Modint<MOD>& x) noexcept { return os << x.val; } constexpr Modint<MOD> pow(long long n) noexcept { if (n == 0) return 1; if (n < 0) return this->pow(-n).inv(); Modint<MOD> ret = pow(n >> 1); ret *= ret; if (n & 1) ret *= *this; return ret; } constexpr Modint<MOD> inv() noexcept { long long a = this->val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b, swap(a, b); u -= t * v, swap(u, v); } return Modint<MOD>(u); } }; // const int MOD1 = MOD7, MOD2 = MOD998, MOD3 = 1000000007; // using mint1 = Modint<MOD1>, mint2 = Modint<MOD2>, mint = Modint<MOD3>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n, m; cin >> n >> m; vector<ll> x(m); rep(i, m) { cin >> x[i]; x[i] *= 10000; } vector c(n, vector<ll> (m, 0LL)); vector t(n, 0LL); rep(i, n) { rep(j, m) cin >> c[i][j]; cin >> t[i]; } auto solve = [&](bool flag = 0) -> void { set<vector<ll>> st; rep(i, n) { if(t[i] == 100) { vector<ll> v(m); rep(j, m) { v[j] = c[i][j] * 100 * t[i]; } if(v == x) { cout << "Yes" << endl; exit(0); } } else { bool ng = false; vector<ll> v(m); rep(j, m) { ll num = x[j] - c[i][j] * 100 * t[i]; // if(flag and i == n - 1) cout << num << " " << (ll(100) - t[i]) << endl; if(num % (ll(100) - t[i])) { ng = true; break; } num /= (ll(100) - t[i]); v[j] = num; // if(flag and i == n - 1) cout << v[j] << " "; } // if(flag and i == n - 1) cout <<endl; if(!ng) { if(st.count(v)) { cout << "Yes" << endl; exit(0); } } } vector<ll> v(m); rep(j, m) { v[j] = t[i] * c[i][j]; } st.insert(v); } }; solve(); reverse(all(c)); reverse(all(t)); solve(1); cout << "No" << endl; return 0; }