Submission #41606415


Source Code Expand

/*+Rainybunny+*/

#include <bits/stdc++.h>

#define rep(i, l, r) for (int i = l, rep##i = r; i <= rep##i; ++i)
#define per(i, r, l) for (int i = r, per##i = l; i >= per##i; --i)

const int MAXN = 3e5;
int n;
char S[MAXN + 5];

int main() {
    int T; scanf("%d", &T);
    while (T--) {
        scanf("%d %s", &n, S + 1);
        if (std::count(S + 1, S + n + 1, 'A') == n) { puts("A"); continue; }
        if (std::count(S + 1, S + n + 1, 'B') == n) { puts("B"); continue; }
        rep (i, 1, n - 1) if (S[i] == 'B' && S[i + 1] == 'A') {
            puts("A"); goto FIN;
        }
        puts("B");
        FIN: ;
    }
    return 0;
}

Submission Info

Submission Time
Task A - Right Side Character
User Rainybunny
Language C++ (GCC 9.2.1)
Score 400
Code Size 663 Byte
Status AC
Exec Time 13 ms
Memory 3988 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   13 |     int T; scanf("%d", &T);
      |            ~~~~~^~~~~~~~~~
./Main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   15 |         scanf("%d %s", &n, S + 1);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 1
AC × 27
Set Name Test Cases
Sample 00_sample_01.txt
All 00_sample_01.txt, 01_small_all_01.txt, 01_small_all_02.txt, 02_rand_01.txt, 02_rand_02.txt, 02_rand_03.txt, 02_rand_04.txt, 02_rand_05.txt, 02_rand_06.txt, 02_rand_07.txt, 02_rand_08.txt, 02_rand_09.txt, 02_rand_10.txt, 02_rand_11.txt, 02_rand_12.txt, 02_rand_13.txt, 02_rand_14.txt, 02_rand_15.txt, 02_rand_16.txt, 02_rand_17.txt, 02_rand_18.txt, 02_rand_19.txt, 02_rand_20.txt, 02_rand_21.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 13 ms 3548 KiB
01_small_all_01.txt AC 5 ms 3552 KiB
01_small_all_02.txt AC 4 ms 3604 KiB
02_rand_01.txt AC 2 ms 3572 KiB
02_rand_02.txt AC 5 ms 3548 KiB
02_rand_03.txt AC 5 ms 3568 KiB
02_rand_04.txt AC 6 ms 3600 KiB
02_rand_05.txt AC 4 ms 3424 KiB
02_rand_06.txt AC 4 ms 3988 KiB
02_rand_07.txt AC 8 ms 3832 KiB
02_rand_08.txt AC 5 ms 3768 KiB
02_rand_09.txt AC 4 ms 3832 KiB
02_rand_10.txt AC 4 ms 3872 KiB
02_rand_11.txt AC 5 ms 3712 KiB
02_rand_12.txt AC 2 ms 3860 KiB
02_rand_13.txt AC 4 ms 3892 KiB
02_rand_14.txt AC 5 ms 3712 KiB
02_rand_15.txt AC 6 ms 3716 KiB
02_rand_16.txt AC 4 ms 3836 KiB
02_rand_17.txt AC 3 ms 3852 KiB
02_rand_18.txt AC 7 ms 3892 KiB
02_rand_19.txt AC 6 ms 3872 KiB
02_rand_20.txt AC 5 ms 3836 KiB
02_rand_21.txt AC 5 ms 3712 KiB
03_handmade_01.txt AC 4 ms 3572 KiB
03_handmade_02.txt AC 6 ms 3872 KiB
03_handmade_03.txt AC 5 ms 3832 KiB