Submission #29676246


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)

std::vector<std::string> split(const std::string& text, const char delim);

using ll = long long int;
using llu = unsigned long long int;

int main(){
    string buffer;
    getline(cin, buffer);
    auto scale = split(buffer, ' ');
    const int N = stoi(scale.front());
    const int M = stoi(scale.back());

    getline(cin, buffer);
    map<int, int> A;
    for (const auto& item : split(buffer, ' ')) {
        A[stoi(item)]++;
    }

    getline(cin, buffer);
    vector<int> B;
    B.reserve(M);
    for (const auto& item : split(buffer, ' ')) {
        B.emplace_back(stoi(item));
    }

    for (const auto& b : B) {
        if (A.find(b) != A.end() && 0 < A[b]) {
            A[b]--;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

std::vector<std::string> split(const std::string& text, char delim) {
    std::vector<std::string> elems;
    std::stringstream ss(text);
    std::string item;
    while (std::getline(ss, item, delim)) {
    if (!item.empty()) {
            elems.emplace_back(item);
        }
    }
    return elems;
}

Submission Info

Submission Time
Task B - Pasta
User low10603
Language C++ (GCC 9.2.1)
Score 200
Code Size 1278 Byte
Status AC
Exec Time 6 ms
Memory 3776 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:15: warning: unused variable ‘N’ [-Wunused-variable]
   14 |     const int N = stoi(scale.front());
      |               ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 20
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.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_b_00.txt, random_b_01.txt
Case Name Status Exec Time Memory
example_00.txt AC 6 ms 3460 KiB
example_01.txt AC 3 ms 3640 KiB
example_02.txt AC 2 ms 3460 KiB
hand_00.txt AC 4 ms 3620 KiB
hand_01.txt AC 4 ms 3540 KiB
hand_02.txt AC 4 ms 3684 KiB
hand_03.txt AC 2 ms 3524 KiB
hand_04.txt AC 2 ms 3400 KiB
random_00.txt AC 4 ms 3672 KiB
random_01.txt AC 3 ms 3688 KiB
random_02.txt AC 3 ms 3492 KiB
random_03.txt AC 3 ms 3564 KiB
random_04.txt AC 4 ms 3700 KiB
random_05.txt AC 3 ms 3624 KiB
random_06.txt AC 4 ms 3708 KiB
random_07.txt AC 6 ms 3724 KiB
random_08.txt AC 4 ms 3600 KiB
random_09.txt AC 3 ms 3776 KiB
random_b_00.txt AC 4 ms 3684 KiB
random_b_01.txt AC 3 ms 3732 KiB