Submission #41359184


Source Code Expand

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N=200;
int a[N],b[N];
int main()
{
	string s,t;cin>>s>>t;
	for(int i=0;i<s.length();i++){
		a[s[i]]++;
		b[t[i]]++;
	}
	for(int i='a';i<='z';i++){
		if(a[i]==b[i]) continue;
		if(i!='a'&&i!='t'&&i!='c'&&i!='o'&&i!='d'&&i!='e'&&i!='r') {cout<<"No"<<endl;return 0;}
		if(a[i]>b[i]&&a[i]-b[i]<=b['@']) {b['@']-=a[i]-b[i];continue;}
		if(a[i]<b[i]&&b[i]-a[i]<=a['@']) {a['@']-=b[i]-a[i];continue;}
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
} 

Submission Info

Submission Time
Task C - AtCoder Cards
User gangbengr
Language C++ (GCC 9.2.1)
Score 300
Code Size 563 Byte
Status AC
Exec Time 15 ms
Memory 3920 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:15: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   10 |  for(int i=0;i<s.length();i++){
      |              ~^~~~~~~~~~~
./Main.cpp:11:9: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   11 |   a[s[i]]++;
      |         ^
./Main.cpp:12:9: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   12 |   b[t[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 12 ms 3824 KiB
random_02.txt AC 11 ms 3804 KiB
random_03.txt AC 12 ms 3920 KiB
random_04.txt AC 11 ms 3680 KiB
random_05.txt AC 12 ms 3852 KiB
random_06.txt AC 3 ms 3548 KiB
random_07.txt AC 12 ms 3808 KiB
random_08.txt AC 10 ms 3684 KiB
random_09.txt AC 11 ms 3920 KiB
random_10.txt AC 7 ms 3732 KiB
random_11.txt AC 12 ms 3784 KiB
random_12.txt AC 2 ms 3500 KiB
random_13.txt AC 11 ms 3812 KiB
random_14.txt AC 7 ms 3600 KiB
random_15.txt AC 3 ms 3636 KiB
random_16.txt AC 11 ms 3656 KiB
random_17.txt AC 15 ms 3616 KiB
random_18.txt AC 5 ms 3656 KiB
random_19.txt AC 9 ms 3708 KiB
random_20.txt AC 6 ms 3696 KiB
random_21.txt AC 10 ms 3544 KiB
random_22.txt AC 15 ms 3784 KiB
random_23.txt AC 2 ms 3416 KiB
random_24.txt AC 2 ms 3532 KiB
random_25.txt AC 2 ms 3472 KiB
random_26.txt AC 2 ms 3592 KiB
random_27.txt AC 2 ms 3416 KiB
random_28.txt AC 14 ms 3804 KiB
random_29.txt AC 12 ms 3688 KiB
random_30.txt AC 12 ms 3736 KiB
sample_01.txt AC 2 ms 3544 KiB
sample_02.txt AC 2 ms 3592 KiB
sample_03.txt AC 2 ms 3484 KiB
sample_04.txt AC 2 ms 3580 KiB