提出 #41356511


ソースコード 拡げる

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define test int T; cin >> T; while(T--)
using namespace std;
using lnt = long long;

int cnt[27][2];

int main(){
    cin.tie(nullptr), ios::sync_with_stdio(false);

    string s, t;
    cin >> s >> t;
    for(int i=0; s[i]; i++){
        if(s[i] >= 'a' && s[i] <= 'z') cnt[s[i] - 'a'][0]++;
        else cnt[26][0]++;
    }
    for(int i=0; t[i]; i++){
        if(t[i] >= 'a' && t[i] <= 'z') cnt[t[i] - 'a'][1]++;
        else cnt[26][1]++;
    }
    int sx = 0, tx = 0;
    for(int i=0; i<26; i++){
        if(i != 0 && i != 2 && i != 3 && i != 4 && i != 14 && i != 19 && i != 17){
            if(cnt[i][0] != cnt[i][1]){
                cout << "No";
                return 0;
            }
        }
        else{
            if(cnt[i][0] > cnt[i][1]) sx += cnt[i][0] - cnt[i][1];
            else if(cnt[i][0] < cnt[i][1]) tx += cnt[i][1] - cnt[i][0];
        }
    }
    if(sx <= cnt[26][1] && tx <= cnt[26][0]) cout << "Yes";
    else cout << "No";
}

提出情報

提出日時
問題 C - AtCoder Cards
ユーザ pluie
言語 C++ (GCC 9.2.1)
得点 300
コード長 1059 Byte
結果 AC
実行時間 9 ms
メモリ 3804 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 4
AC × 34
セット名 テストケース
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 9 ms 3748 KiB
random_02.txt AC 5 ms 3628 KiB
random_03.txt AC 9 ms 3772 KiB
random_04.txt AC 5 ms 3708 KiB
random_05.txt AC 6 ms 3804 KiB
random_06.txt AC 2 ms 3588 KiB
random_07.txt AC 6 ms 3624 KiB
random_08.txt AC 5 ms 3704 KiB
random_09.txt AC 6 ms 3768 KiB
random_10.txt AC 3 ms 3624 KiB
random_11.txt AC 7 ms 3700 KiB
random_12.txt AC 2 ms 3588 KiB
random_13.txt AC 6 ms 3680 KiB
random_14.txt AC 4 ms 3700 KiB
random_15.txt AC 2 ms 3660 KiB
random_16.txt AC 6 ms 3728 KiB
random_17.txt AC 5 ms 3680 KiB
random_18.txt AC 2 ms 3624 KiB
random_19.txt AC 3 ms 3780 KiB
random_20.txt AC 2 ms 3704 KiB
random_21.txt AC 4 ms 3784 KiB
random_22.txt AC 9 ms 3700 KiB
random_23.txt AC 2 ms 3544 KiB
random_24.txt AC 2 ms 3612 KiB
random_25.txt AC 2 ms 3616 KiB
random_26.txt AC 2 ms 3544 KiB
random_27.txt AC 4 ms 3448 KiB
random_28.txt AC 6 ms 3644 KiB
random_29.txt AC 5 ms 3804 KiB
random_30.txt AC 5 ms 3712 KiB
sample_01.txt AC 1 ms 3616 KiB
sample_02.txt AC 2 ms 3512 KiB
sample_03.txt AC 2 ms 3616 KiB
sample_04.txt AC 3 ms 3496 KiB