Submission #51039065


Source Code Expand

#include <bits/stdc++.h>
#include <atcoder/modint>

namespace {
    using ModInt [[maybe_unused]] = atcoder::modint998244353;
    using Num [[maybe_unused]] = long long int;
    using Vec [[maybe_unused]] = std::vector<Num>;
    using Set [[maybe_unused]] = std::set<Num>;
    using Mset [[maybe_unused]] = std::multiset<Num>;
    using Edges [[maybe_unused]] = std::vector<std::vector<Num>>;

    template<typename T>
    using Q [[maybe_unused]] = std::queue<T>;

    template<typename T>
    using PQ [[maybe_unused]] = std::priority_queue<T, std::vector<T>, std::greater<T>>;
}

void solve(std::istream& is, std::ostream& os) {
    Num n {0};
    is >> n;
    Vec aset(n);
    for(auto&& a : aset) {
        is >> a;
    }

    Num m {0};
    is >> m;
    Vec bset(m);
    for(auto&& b : bset) {
        is >> b;
    }

    Num l {0};
    is >> l;
    Vec cset(l);
    for(auto&& c : cset) {
        is >> c;
    }

    Set ss;
    for(const auto& a : aset) {
        for(const auto& b : bset) {
            for(const auto& c : cset) {
                ss.insert(a + b + c);
            }
        }
    }

    Num q {0};
    is >> q;
    while(q-- > 0) {
        Num x {0};
        is >> x;
        if (ss.contains(x)) {
            os << "Yes\n";
        } else {
            os << "No\n";
        }
    }
}

int main(void) {
    solve(std::cin, std::cout);
    return 0;
}

Submission Info

Submission Time
Task C - A+B+C
User zettsut
Language C++ 20 (gcc 12.2)
Score 250
Code Size 1444 Byte
Status AC
Exec Time 855 ms
Memory 50428 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 1
AC × 23
Set Name Test Cases
Sample sample_01.txt
All min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, sample_01.txt
Case Name Status Exec Time Memory
min.txt AC 1 ms 3620 KiB
random_01.txt AC 220 ms 5520 KiB
random_02.txt AC 68 ms 5160 KiB
random_03.txt AC 232 ms 4512 KiB
random_04.txt AC 628 ms 39644 KiB
random_05.txt AC 143 ms 11960 KiB
random_06.txt AC 45 ms 10532 KiB
random_07.txt AC 156 ms 7800 KiB
random_08.txt AC 659 ms 50228 KiB
random_09.txt AC 208 ms 4436 KiB
random_10.txt AC 195 ms 10864 KiB
random_11.txt AC 389 ms 20244 KiB
random_12.txt AC 855 ms 39752 KiB
random_13.txt AC 236 ms 5580 KiB
random_14.txt AC 540 ms 25096 KiB
random_15.txt AC 414 ms 25480 KiB
random_16.txt AC 764 ms 50280 KiB
random_17.txt AC 389 ms 50360 KiB
random_18.txt AC 399 ms 50352 KiB
random_19.txt AC 390 ms 50412 KiB
random_20.txt AC 401 ms 50428 KiB
random_21.txt AC 396 ms 50364 KiB
sample_01.txt AC 1 ms 3552 KiB