Submission #33618240


Source Code Expand

#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
//#define mp make_pair
//#define OO(x) fixed<<setprecision(x)
using namespace std;
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int read(){
	char ch=getchar(); int w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
const int M=1e6+10;
int n;
char s[M];
bool g[M][2][2];
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read();
	scanf("%s",s+1);
	if (n==2){
		if (s[1]==s[2]){
			puts("Yes");
		}
		else puts("No");
		return 0;
	}
	if (s[1]=='B'){
		puts("Yes");
		return 0;
	}
	if (s[n]=='B'){
		puts("No");
		return 0;
	}
	cout<<"Yes\n";
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/

Submission Info

Submission Time
Task A - AB Palindrome
User yangziheng
Language C++ (GCC 9.2.1)
Score 400
Code Size 1158 Byte
Status AC
Exec Time 12 ms
Memory 3884 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   26 |  scanf("%s",s+1);
      |  ~~~~~^~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 25
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 03_max_01.txt, 03_max_02.txt, 03_max_03.txt, 03_max_04.txt, 03_max_05.txt, 03_max_06.txt, 03_max_07.txt, 03_max_08.txt, 03_max_09.txt, 03_max_10.txt, 03_max_11.txt, 03_max_12.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 12 ms 3472 KiB
00_sample_02.txt AC 2 ms 3604 KiB
01_small_01.txt AC 2 ms 3528 KiB
01_small_02.txt AC 2 ms 3616 KiB
01_small_03.txt AC 2 ms 3688 KiB
01_small_04.txt AC 2 ms 3472 KiB
02_random_01.txt AC 2 ms 3704 KiB
02_random_02.txt AC 2 ms 3732 KiB
02_random_03.txt AC 2 ms 3740 KiB
02_random_04.txt AC 2 ms 3580 KiB
02_random_05.txt AC 2 ms 3584 KiB
02_random_06.txt AC 2 ms 3664 KiB
02_random_07.txt AC 2 ms 3656 KiB
03_max_01.txt AC 2 ms 3664 KiB
03_max_02.txt AC 2 ms 3768 KiB
03_max_03.txt AC 2 ms 3812 KiB
03_max_04.txt AC 2 ms 3668 KiB
03_max_05.txt AC 2 ms 3600 KiB
03_max_06.txt AC 2 ms 3800 KiB
03_max_07.txt AC 3 ms 3720 KiB
03_max_08.txt AC 2 ms 3720 KiB
03_max_09.txt AC 2 ms 3884 KiB
03_max_10.txt AC 2 ms 3772 KiB
03_max_11.txt AC 3 ms 3676 KiB
03_max_12.txt AC 2 ms 3664 KiB