Submission #28919221


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;

namespace Tasks
{
    public class C
    {
        public static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Scanner.ScanLine();
            var (l, r) = (0, S.Length - 1);
            while (r >= 0 && S[r] == 'a') r--;
            while (l < r && S[l] == 'a') l++;

            var lc = l;
            var rc = S.Length - r - 1;
            if (lc > rc)
            {
                Console.WriteLine("No");
                return;
            }

            var t = S[l..(r + 1)];
            var answer = t == new string(t.Reverse().ToArray());
            Console.WriteLine(answer ? "Yes" : "No");
        }

        public static class Scanner
        {
            public static string ScanLine() => Console.ReadLine()?.Trim() ?? string.Empty;
            public static string[] Scan() => ScanLine().Split(' ');
            public static T Scan<T>() where T : IConvertible => Convert<T>(Scan()[0]);
            public static (T1, T2) Scan<T1, T2>() where T1 : IConvertible where T2 : IConvertible
            {
                var line = Scan();
                return (Convert<T1>(line[0]), Convert<T2>(line[1]));
            }
            public static (T1, T2, T3) Scan<T1, T2, T3>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible
            {
                var line = Scan();
                return (Convert<T1>(line[0]), Convert<T2>(line[1]), Convert<T3>(line[2]));
            }
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible
            {
                var line = Scan();
                return (Convert<T1>(line[0]), Convert<T2>(line[1]), Convert<T3>(line[2]), Convert<T4>(line[3]));
            }
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible where T5 : IConvertible
            {
                var line = Scan();
                return (Convert<T1>(line[0]), Convert<T2>(line[1]), Convert<T3>(line[2]), Convert<T4>(line[3]), Convert<T5>(line[4]));
            }
            public static (T1, T2, T3, T4, T5, T6) Scan<T1, T2, T3, T4, T5, T6>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible where T5 : IConvertible where T6 : IConvertible
            {
                var line = Scan();
                return (Convert<T1>(line[0]), Convert<T2>(line[1]), Convert<T3>(line[2]), Convert<T4>(line[3]), Convert<T5>(line[4]), Convert<T6>(line[5]));
            }
            public static IEnumerable<T> ScanEnumerable<T>() where T : IConvertible => Scan().Select(Convert<T>);
            private static T Convert<T>(string value) where T : IConvertible => (T)System.Convert.ChangeType(value, typeof(T));
        }
    }
}

Submission Info

Submission Time
Task C - kasaka
User AconCavy
Language C# (.NET Core 3.1.201)
Score 300
Code Size 3308 Byte
Status AC
Exec Time 101 ms
Memory 35196 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 29
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, random_00.txt, 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
Case Name Status Exec Time Memory
example_00.txt AC 77 ms 26408 KiB
example_01.txt AC 78 ms 25652 KiB
example_02.txt AC 81 ms 26328 KiB
hand_00.txt AC 93 ms 32816 KiB
hand_01.txt AC 84 ms 30332 KiB
hand_02.txt AC 84 ms 30236 KiB
hand_03.txt AC 90 ms 33052 KiB
hand_04.txt AC 85 ms 30508 KiB
hand_05.txt AC 89 ms 30972 KiB
hand_06.txt AC 80 ms 29432 KiB
hand_07.txt AC 82 ms 30180 KiB
hand_08.txt AC 81 ms 29588 KiB
hand_09.txt AC 72 ms 26400 KiB
hand_10.txt AC 81 ms 26404 KiB
hand_11.txt AC 80 ms 30252 KiB
hand_12.txt AC 79 ms 31512 KiB
hand_13.txt AC 84 ms 31900 KiB
random_00.txt AC 101 ms 34160 KiB
random_01.txt AC 90 ms 35196 KiB
random_02.txt AC 95 ms 34308 KiB
random_03.txt AC 98 ms 33112 KiB
random_04.txt AC 91 ms 33568 KiB
random_05.txt AC 96 ms 34356 KiB
random_06.txt AC 94 ms 35048 KiB
random_07.txt AC 90 ms 33476 KiB
random_08.txt AC 88 ms 33692 KiB
random_09.txt AC 94 ms 29120 KiB
random_10.txt AC 81 ms 29476 KiB
random_11.txt AC 82 ms 29832 KiB