Submission #59313988
Source Code Expand
///In the name of ALLAH, The Most Gracious and The Most Merciful
///Praise be to ALLAH
#include<bits/stdc++.h>
using namespace std;
const int sz = 101;
char ar[sz];
using ll = long long;
#define el "\n"
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testCase int __; cin >> __; while(__--)
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
void solve()
{
int n, f = 1; cin >> n;
for(int i = 0; i < n; i++)
{
cin >> ar[i];
}
for(int i = 0; i < n - 1; i++)
{
if((ar[i] == 'a' && ar[i + 1] == 'b') || (ar[i] == 'b' && ar[i + 1] == 'a'))
{
f = 0;
break;
}
}
if(!f) cout << "Yes" << el;
else cout << "No" << el;
}
int main()
{
optimize();
//testCase
solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - ab |
| User | InFi4D_0 |
| Language | C++ 20 (gcc 12.2) |
| Score | 100 |
| Code Size | 923 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3520 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3520 KiB |
| 00_sample_01.txt | AC | 1 ms | 3400 KiB |
| 00_sample_02.txt | AC | 1 ms | 3464 KiB |
| 01_random_00.txt | AC | 1 ms | 3472 KiB |
| 01_random_01.txt | AC | 1 ms | 3436 KiB |
| 01_random_02.txt | AC | 1 ms | 3416 KiB |
| 01_random_03.txt | AC | 1 ms | 3416 KiB |
| 01_random_04.txt | AC | 1 ms | 3468 KiB |
| 01_random_05.txt | AC | 1 ms | 3448 KiB |
| 01_random_06.txt | AC | 1 ms | 3388 KiB |
| 01_random_07.txt | AC | 1 ms | 3516 KiB |
| 02_corner_00.txt | AC | 1 ms | 3420 KiB |
| 02_corner_01.txt | AC | 1 ms | 3396 KiB |
| 02_corner_02.txt | AC | 1 ms | 3464 KiB |
| 02_corner_03.txt | AC | 1 ms | 3392 KiB |