提出 #41382728


ソースコード 拡げる

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

const int MM = 2e5 + 1;
int firstat = 0, secondat = 0;
string s, t;
map<char, int> firstone, secondone;
set<char> needed_in_first, needed_in_second;

set<char> st = {'a', 't', 'c', 'o', 'd', 'e', 'r'};

int32_t main() {
    cin >> s >> t;
    for (auto i : s) {
        if (i != '@') firstone[i]++;
        else firstat++;
    }
    for (auto i : t) {
        if (i != '@') secondone[i]++;
        else secondat++;
    }
    for (auto i : s) {
        if (i != '@') {
            if (firstone[i] > secondone[i]) needed_in_second.insert(i);
        }
    }
    for (auto i : t) {
        if (i != '@') {
            if (secondone[i] > firstone[i]) needed_in_first.insert(i);
        }
    }
    for (auto i : needed_in_first) {
        if (st.find(i) == st.end()) {
            cout << "No" << endl; return false;
        }
        else if (firstat >= secondone[i]) firstat -= secondone[i];
        else {
            cout << "No" << endl; return false;
        }
    }
    for (auto i : needed_in_second) {
        if (st.find(i) == st.end()) {
            cout << "No" << endl; return false;
        }
        else if (secondat >= firstone[i]) secondat -= firstone[i];
        else {
            cout << "No" << endl; return false;
        }
    }
    cout << "Yes" << endl;
}

提出情報

提出日時
問題 C - AtCoder Cards
ユーザ volcano8
言語 C++ (GCC 9.2.1)
得点 0
コード長 1456 Byte
結果 WA
実行時間 38 ms
メモリ 3868 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 300
結果
AC × 4
AC × 32
WA × 2
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All 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, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 31 ms 3836 KiB
random_02.txt AC 21 ms 3744 KiB
random_03.txt AC 26 ms 3808 KiB
random_04.txt AC 12 ms 3700 KiB
random_05.txt AC 32 ms 3736 KiB
random_06.txt AC 8 ms 3692 KiB
random_07.txt AC 32 ms 3860 KiB
random_08.txt AC 23 ms 3716 KiB
random_09.txt AC 31 ms 3868 KiB
random_10.txt AC 19 ms 3724 KiB
random_11.txt AC 38 ms 3744 KiB
random_12.txt AC 4 ms 3508 KiB
random_13.txt AC 24 ms 3840 KiB
random_14.txt AC 15 ms 3716 KiB
random_15.txt AC 6 ms 3616 KiB
random_16.txt AC 20 ms 3564 KiB
random_17.txt AC 22 ms 3748 KiB
random_18.txt AC 12 ms 3672 KiB
random_19.txt AC 22 ms 3716 KiB
random_20.txt AC 13 ms 3704 KiB
random_21.txt AC 19 ms 3564 KiB
random_22.txt AC 29 ms 3820 KiB
random_23.txt AC 2 ms 3432 KiB
random_24.txt AC 3 ms 3540 KiB
random_25.txt AC 3 ms 3628 KiB
random_26.txt AC 3 ms 3548 KiB
random_27.txt AC 2 ms 3488 KiB
random_28.txt AC 25 ms 3832 KiB
random_29.txt WA 23 ms 3808 KiB
random_30.txt WA 24 ms 3836 KiB
sample_01.txt AC 2 ms 3552 KiB
sample_02.txt AC 2 ms 3568 KiB
sample_03.txt AC 3 ms 3484 KiB
sample_04.txt AC 3 ms 3532 KiB