48632023-04-03 08:24:16vááááBejgli (80 pont)csharpAccepted 80/8085ms41216 KiB
using System;
using System.Linq;

namespace bejgli2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] bejgli = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ki = 0, max = int.MinValue, id=-1;
            int[] reszek = new int[n+1];
            for (int i = 0; i < n; i++)
            {
                reszek[bejgli[i]]++;
                i += bejgli[i] - 1;
            }
            for (int i = 0; i < n+1; i++)
            {
                if (reszek[i] != 0) ki += reszek[i];
                if(max < reszek[i])
                {
                    max = reszek[i];
                    id = i;
                }
            }
            Console.WriteLine(ki);
            Console.WriteLine(id);
            Console.ReadLine();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/029ms21912 KiB
2Accepted0/029ms22080 KiB
3Accepted4/429ms22840 KiB
4Accepted4/429ms23016 KiB
5Accepted4/430ms23300 KiB
6Accepted4/430ms23736 KiB
7Accepted4/435ms23972 KiB
8Accepted4/435ms24224 KiB
9Accepted4/435ms24320 KiB
10Accepted4/435ms24712 KiB
11Accepted4/435ms25168 KiB
12Accepted4/435ms25364 KiB
13Accepted4/439ms25688 KiB
14Accepted4/439ms26332 KiB
15Accepted4/441ms27052 KiB
16Accepted4/443ms27880 KiB
17Accepted4/456ms32048 KiB
18Accepted4/475ms36100 KiB
19Accepted4/485ms39704 KiB
20Accepted4/481ms40184 KiB
21Accepted4/485ms41216 KiB
22Accepted4/479ms38368 KiB