Submission #41353074


Source Code Expand

Copy
#include <bits/stdc++.h>
#define INF (__LONG_LONG_MAX__ / 3)
typedef long long ll;
using namespace std;
string a, b;
vector<ll> cnt_a, cnt_b;
ll w_a, w_b;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> a >> b;
cnt_a.resize(26);
cnt_b.resize(26);
for(ll i = 0; i < a.size(); i++) {
if(a[i] != '@') {
cnt_a[a[i] - 'a']++;
} else {
w_a++;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
#define INF (__LONG_LONG_MAX__ / 3)
typedef long long ll;
using namespace std;

string a, b;
vector<ll> cnt_a, cnt_b;
ll w_a, w_b;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin >> a >> b;
  cnt_a.resize(26);
  cnt_b.resize(26);
  for(ll i = 0; i < a.size(); i++) {
    if(a[i] != '@') {
      cnt_a[a[i] - 'a']++;
    } else {
      w_a++;
    }
  }
  for(ll i = 0; i < b.size(); i++) {
    if(b[i] != '@') {
      cnt_b[b[i] - 'a']++;
    } else {
      w_b++;
    }
  }

  for(ll i = 0 ; i < 26; i++) {
    if(cnt_a[i] == cnt_b[i]) continue;
    if(i + 'a' != 'a' && i + 'a' != 't' && i + 'a' != 'c' && i + 'a' != 'o' && i + 'a' != 'd' && i + 'a' != 'e' && i + 'a' != 'r') {
      cout << "No\n";
      return 0;
    }
    if(cnt_a[i] < cnt_b[i]) {
      w_a -= cnt_b[i] - cnt_a[i];
    } else {
      w_b -= cnt_a[i] - cnt_b[i];
    }
  }

  if(w_a >= 0 && w_b >= 0) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  
  return 0;
}

Submission Info

Submission Time
Task C - AtCoder Cards
User jbhus
Language C++ (GCC 9.2.1)
Score 300
Code Size 1047 Byte
Status AC
Exec Time 16 ms
Memory 3732 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:19: warning: comparison of integer expressions of different signedness: ‘ll’ {aka ‘long long int’} and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   17 |   for(ll i = 0; i < a.size(); i++) {
      |                 ~~^~~~~~~~~~
./Main.cpp:24:19: warning: comparison of integer expressions of different signedness: ‘ll’ {aka ‘long long int’} and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   24 |   for(ll i = 0; i < b.size(); i++) {
      |                 ~~^~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 34
Set Name Test Cases
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
Case Name Status Exec Time Memory
random_01.txt AC 16 ms 3688 KB
random_02.txt AC 7 ms 3696 KB
random_03.txt AC 7 ms 3692 KB
random_04.txt AC 5 ms 3668 KB
random_05.txt AC 8 ms 3700 KB
random_06.txt AC 2 ms 3708 KB
random_07.txt AC 6 ms 3708 KB
random_08.txt AC 6 ms 3692 KB
random_09.txt AC 4 ms 3704 KB
random_10.txt AC 4 ms 3696 KB
random_11.txt AC 5 ms 3732 KB
random_12.txt AC 2 ms 3496 KB
random_13.txt AC 7 ms 3632 KB
random_14.txt AC 4 ms 3692 KB
random_15.txt AC 3 ms 3608 KB
random_16.txt AC 6 ms 3696 KB
random_17.txt AC 7 ms 3700 KB
random_18.txt AC 4 ms 3680 KB
random_19.txt AC 4 ms 3672 KB
random_20.txt AC 3 ms 3732 KB
random_21.txt AC 4 ms 3616 KB
random_22.txt AC 6 ms 3676 KB
random_23.txt AC 2 ms 3528 KB
random_24.txt AC 2 ms 3636 KB
random_25.txt AC 3 ms 3532 KB
random_26.txt AC 2 ms 3552 KB
random_27.txt AC 1 ms 3568 KB
random_28.txt AC 9 ms 3692 KB
random_29.txt AC 6 ms 3680 KB
random_30.txt AC 9 ms 3696 KB
sample_01.txt AC 2 ms 3568 KB
sample_02.txt AC 2 ms 3556 KB
sample_03.txt AC 2 ms 3556 KB
sample_04.txt AC 2 ms 3528 KB


2025-03-05 (Wed)
18:12:02 +00:00