48622023-04-03 08:21:26vááááBejgli (80 pont)csharpRuntime error 76/8083ms41400 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];
            for (int i = 0; i < n; i++)
            {
                reszek[bejgli[i]]++;
                i += bejgli[i] - 1;
            }
            for (int i = 0; i < n; 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
base76/80
1Accepted0/032ms21928 KiB
2Accepted0/030ms22088 KiB
3Accepted4/429ms22836 KiB
4Accepted4/430ms22852 KiB
5Accepted4/430ms22872 KiB
6Runtime error0/432ms22944 KiB
7Accepted4/435ms24672 KiB
8Accepted4/434ms25040 KiB
9Accepted4/435ms24776 KiB
10Accepted4/435ms25456 KiB
11Accepted4/437ms25672 KiB
12Accepted4/437ms25848 KiB
13Accepted4/437ms26704 KiB
14Accepted4/439ms27344 KiB
15Accepted4/441ms27820 KiB
16Accepted4/443ms28484 KiB
17Accepted4/457ms32580 KiB
18Accepted4/475ms37068 KiB
19Accepted4/479ms40436 KiB
20Accepted4/481ms40376 KiB
21Accepted4/483ms41400 KiB
22Accepted4/476ms38772 KiB