Submission #6017466


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadInt();
            var memo = new int[N];
            var dict = new Dictionary<string, int>();
            for (int i = 0; i < N; i++)
            {
                var n = Read();
                if (!dict.ContainsKey(n))
                    dict.Add(n, 1);
                else
                    dict[n] += 1;
            }
            Println(dict.First(x => x.Value == dict.Max(y => y.Value)).Key);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

Submission Info

Submission Time
Task B - 投票
User okitou
Language C# (Mono 4.6.2.0)
Score 100
Code Size 2809 Byte
Status AC
Exec Time 24 ms
Memory 13280 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, case_01.txt, case_02.txt, case_03.txt, case_04.txt, case_05.txt, case_06.txt, case_07.txt, case_08.txt, case_09.txt, case_10.txt, case_11.txt, case_12.txt, case_13.txt, case_14.txt, case_15.txt
Case Name Status Exec Time Memory
case_01.txt AC 24 ms 11232 KB
case_02.txt AC 24 ms 11232 KB
case_03.txt AC 24 ms 9184 KB
case_04.txt AC 23 ms 9184 KB
case_05.txt AC 23 ms 9184 KB
case_06.txt AC 24 ms 11232 KB
case_07.txt AC 24 ms 11232 KB
case_08.txt AC 24 ms 11348 KB
case_09.txt AC 24 ms 11232 KB
case_10.txt AC 23 ms 9184 KB
case_11.txt AC 24 ms 9300 KB
case_12.txt AC 24 ms 13280 KB
case_13.txt AC 24 ms 11232 KB
case_14.txt AC 24 ms 11348 KB
case_15.txt AC 24 ms 11232 KB
sample_01.txt AC 24 ms 11348 KB
sample_02.txt AC 23 ms 11232 KB
sample_03.txt AC 24 ms 11232 KB