Submission #73684867
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll ans = 0;
string S,T;
cin >> S >> T;
vector<char> s(0),t(0);
vector<ll> X(1),Y(1);
for(ll i = 0;i < S.size();i++){
if(S[i] == 'A'){
X[X.size() - 1]++;
}
else{
s.push_back(S[i]);
X.push_back(0);
}
}
for(ll i = 0;i < T.size();i++){
if(T[i] == 'A'){
Y[Y.size() - 1]++;
}
else{
t.push_back(T[i]);
Y.push_back(0);
}
}
if(s != t){
cout << -1;
}
else{
for(ll i = 0;i < X.size();i++){
ans+=abs(X[i] - Y[i]);
}
cout << ans;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Insert and Erase A |
| User | MI6174 |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 654 Byte |
| Status | AC |
| Exec Time | 13 ms |
| Memory | 12960 KiB |
Compile Error
./Main.cpp: In function 'int main()':
./Main.cpp:11:18: 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]
11 | for(ll i = 0;i < S.size();i++){
| ~~^~~~~~~~~~
./Main.cpp:20:18: 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]
20 | for(ll i = 0;i < T.size();i++){
| ~~^~~~~~~~~~
./Main.cpp:33:20: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(ll i = 0;i < X.size();i++){
| ~~^~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 04_handmade_00.txt, 04_handmade_01.txt, 04_handmade_02.txt, 04_handmade_03.txt, 04_handmade_04.txt, 04_handmade_05.txt, 04_handmade_06.txt, 04_handmade_07.txt, 04_handmade_08.txt, 04_handmade_09.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3444 KiB |
| 00_sample_01.txt | AC | 1 ms | 3576 KiB |
| 00_sample_02.txt | AC | 1 ms | 3476 KiB |
| 00_sample_03.txt | AC | 1 ms | 3428 KiB |
| 01_random_00.txt | AC | 3 ms | 5248 KiB |
| 01_random_01.txt | AC | 5 ms | 5960 KiB |
| 01_random_02.txt | AC | 13 ms | 12796 KiB |
| 02_random2_00.txt | AC | 8 ms | 9020 KiB |
| 02_random2_01.txt | AC | 8 ms | 4552 KiB |
| 02_random2_02.txt | AC | 11 ms | 10248 KiB |
| 02_random2_03.txt | AC | 12 ms | 9704 KiB |
| 02_random2_04.txt | AC | 9 ms | 8464 KiB |
| 02_random2_05.txt | AC | 6 ms | 5080 KiB |
| 02_random2_06.txt | AC | 10 ms | 9676 KiB |
| 02_random2_07.txt | AC | 6 ms | 4668 KiB |
| 02_random2_08.txt | AC | 9 ms | 6368 KiB |
| 02_random2_09.txt | AC | 10 ms | 6836 KiB |
| 02_random2_10.txt | AC | 10 ms | 9456 KiB |
| 02_random2_11.txt | AC | 11 ms | 10296 KiB |
| 03_random3_00.txt | AC | 12 ms | 12452 KiB |
| 03_random3_01.txt | AC | 8 ms | 6664 KiB |
| 03_random3_02.txt | AC | 9 ms | 9336 KiB |
| 03_random3_03.txt | AC | 10 ms | 8288 KiB |
| 04_handmade_00.txt | AC | 1 ms | 3476 KiB |
| 04_handmade_01.txt | AC | 1 ms | 3620 KiB |
| 04_handmade_02.txt | AC | 1 ms | 3416 KiB |
| 04_handmade_03.txt | AC | 1 ms | 3576 KiB |
| 04_handmade_04.txt | AC | 13 ms | 12960 KiB |
| 04_handmade_05.txt | AC | 10 ms | 8504 KiB |
| 04_handmade_06.txt | AC | 10 ms | 8596 KiB |
| 04_handmade_07.txt | AC | 8 ms | 4388 KiB |
| 04_handmade_08.txt | AC | 4 ms | 3892 KiB |
| 04_handmade_09.txt | AC | 4 ms | 3928 KiB |