34602023-02-28 10:48:46gergoSorozat generáláscsharpTime limit exceeded 6/50379ms27476 KiB
using System;
using System.Linq;

namespace sorozatgeneralas
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] elsosor = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int m = elsosor[0], x = elsosor[1], a =elsosor[2], b=elsosor[3], n=elsosor[4], k=elsosor[5];

            int[] tomb = new int[n];
            int szam;

            for (int i = 0; i < n; i++)
            {   
                szam = x * a + b;
                string szam2 = Convert.ToString(szam);

                while (szam2.Length < 4 * m) szam2 = "0" + szam2;

                tomb[i] = int.Parse(szam2.Substring(szam2.Length / 2-1, 2));
                x = tomb[i];
            }

            int cv = 0, min = n;
            for (int i = 0; i < n; i++)
            {
                cv = i + 1;

                while (cv<n)
                {
                    if (tomb[i]==tomb[cv] && cv-i<min) min = cv-i;

                    cv++;
                }
            }

            Array.Sort(tomb);

            Console.WriteLine(min);
            Console.WriteLine(tomb[k]);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base6/50
1Accepted0/032ms22244 KiB
2Time limit exceeded0/0352ms9532 KiB
3Partially correct1/235ms23220 KiB
4Partially correct1/268ms24432 KiB
5Partially correct1/270ms24624 KiB
6Partially correct1/248ms24004 KiB
7Accepted2/2123ms24748 KiB
8Wrong answer0/4133ms27476 KiB
9Time limit exceeded0/4377ms9984 KiB
10Time limit exceeded0/4363ms10928 KiB
11Time limit exceeded0/4379ms11232 KiB
12Time limit exceeded0/4375ms11512 KiB
13Time limit exceeded0/4370ms11816 KiB
14Time limit exceeded0/4372ms12100 KiB
15Time limit exceeded0/4368ms12272 KiB
16Time limit exceeded0/4363ms12244 KiB
17Time limit exceeded0/4351ms12512 KiB