結果

問題 No.2684 折々の色
ユーザー zawakasuzawakasu
提出日時 2024-03-20 22:03:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 703 ms / 2,000 ms
コード長 1,866 bytes
コンパイル時間 2,598 ms
コンパイル使用メモリ 215,984 KB
実行使用メモリ 42,112 KB
最終ジャッジ日時 2024-03-20 22:04:15
合計ジャッジ時間 23,112 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 321 ms
26,496 KB
testcase_12 AC 228 ms
20,480 KB
testcase_13 AC 458 ms
32,384 KB
testcase_14 AC 176 ms
17,280 KB
testcase_15 AC 264 ms
23,680 KB
testcase_16 AC 57 ms
9,600 KB
testcase_17 AC 203 ms
18,688 KB
testcase_18 AC 480 ms
36,224 KB
testcase_19 AC 395 ms
31,616 KB
testcase_20 AC 227 ms
19,072 KB
testcase_21 AC 92 ms
12,672 KB
testcase_22 AC 501 ms
37,248 KB
testcase_23 AC 246 ms
21,504 KB
testcase_24 AC 143 ms
15,616 KB
testcase_25 AC 193 ms
18,048 KB
testcase_26 AC 342 ms
27,264 KB
testcase_27 AC 232 ms
19,328 KB
testcase_28 AC 242 ms
21,376 KB
testcase_29 AC 624 ms
41,216 KB
testcase_30 AC 650 ms
41,600 KB
testcase_31 AC 620 ms
42,112 KB
testcase_32 AC 657 ms
41,472 KB
testcase_33 AC 622 ms
41,856 KB
testcase_34 AC 630 ms
41,472 KB
testcase_35 AC 608 ms
41,856 KB
testcase_36 AC 632 ms
41,600 KB
testcase_37 AC 616 ms
41,984 KB
testcase_38 AC 669 ms
42,112 KB
testcase_39 AC 652 ms
42,112 KB
testcase_40 AC 662 ms
42,112 KB
testcase_41 AC 663 ms
42,112 KB
testcase_42 AC 676 ms
42,112 KB
testcase_43 AC 636 ms
42,112 KB
testcase_44 AC 668 ms
42,112 KB
testcase_45 AC 628 ms
42,112 KB
testcase_46 AC 703 ms
42,112 KB
testcase_47 AC 2 ms
6,548 KB
testcase_48 AC 2 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 2 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>




namespace zawa {

using i16 = std::int16_t;
using i32 = std::int32_t;
using i64 = std::int64_t;
using i128 = __int128_t;

using u8 = std::uint8_t;
using u16 = std::uint16_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;

using usize = std::size_t;

} // namespace zawa


namespace zawa {

void SetFastIO() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
}

void SetPrecision(u32 dig) {
    std::cout << std::fixed << std::setprecision(dig);
}

} // namespace zawa
using namespace zawa;

int main() {
    SetFastIO();

    int n, m; std::cin >> n >> m;
    std::vector<int> x(m);
    for (auto& v : x) std::cin >> v;

    std::map<std::vector<int>, std::vector<int>> map;
    bool ans{};
    for (int i{} ; i < n ; i++) {
        std::vector<int> c(m);
        for (auto& v : c) std::cin >> v;
        long long t; std::cin >> t;
        std::vector<int> left(m), right(m);
        if (t < 100) {
            bool can{true};
            for (int k{} ; k < m ; k++) {
                can &= ((10000 * x[k] - 100 * t * c[k]) % (100 - t)) == 0;
                left[k] = (10000 * x[k] - 100 * t * c[k]) / (100 - t);
            }
            if (can) map[left].push_back(i + 1);
        }
        else {
            ans |= x == c;
        }
        for (int k{} ; k < m ; k++) {
            right[k] = t * c[k];
        }
        map[right].push_back(-i - 1);
    }

    for (const auto& [_, index] : map) {
        std::vector<int> pos, neg;
        for (auto x : index) {
            if (x > 0) pos.push_back(x);
            else if (x < 0) neg.push_back(x);
            else assert(false);
        }
        if (neg.empty()) continue;
        for (auto v : pos) {
            ans |= neg[0] * -1 != v;
            ans |= (neg.size() > 1u and neg[1] * -1 != v);
        }
    }
    std::cout << (ans ? "Yes" : "No") << '\n';
}
0