75042024-01-09 11:42:28TortelliniJrSípálya (55 pont)csharpWrong answer 18/55501ms28144 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Keses
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inp1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] inp2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int loc;
            int locmax;
            int min = int.MaxValue;
            for (int i = inp1[1] - 1; i < inp1[0]; i++)
            {
                locmax = 0;
                loc = 0;
                for (int u = 0; u > -inp1[1]; u--)
                {
                    locmax = Math.Max(locmax, inp2[u + i] + u);
                    //Console.WriteLine("f" + locmax);
                }
                for (int u = 0; u > -inp1[1]; u--)
                {
                    loc += inp2[u + i] - (locmax - u);
                    //Console.WriteLine("g" + loc);
                }
                if (-loc < min)
                {
                    min = -loc;
                }
            }
            Console.WriteLine(min);
            Console.ReadLine();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base18/55
1Accepted0/032ms21924 KiB
2Accepted0/030ms23036 KiB
3Accepted2/235ms23852 KiB
4Accepted2/237ms24328 KiB
5Accepted2/237ms24624 KiB
6Accepted2/237ms25012 KiB
7Wrong answer0/339ms24964 KiB
8Accepted1/170ms26524 KiB
9Accepted1/176ms27168 KiB
10Accepted1/182ms26996 KiB
11Accepted1/1109ms27256 KiB
12Accepted1/1104ms27144 KiB
13Accepted1/1197ms27620 KiB
14Accepted2/2222ms28144 KiB
15Accepted2/2108ms28004 KiB
16Time limit exceeded0/2476ms26292 KiB
17Time limit exceeded0/2481ms26448 KiB
18Time limit exceeded0/2449ms26828 KiB
19Time limit exceeded0/3469ms27244 KiB
20Time limit exceeded0/2458ms27412 KiB
21Time limit exceeded0/2462ms27268 KiB
22Time limit exceeded0/2458ms27312 KiB
23Time limit exceeded0/2477ms27320 KiB
24Time limit exceeded0/2501ms27792 KiB
25Time limit exceeded0/2453ms27320 KiB
26Time limit exceeded0/2477ms27524 KiB
27Time limit exceeded0/2474ms27456 KiB
28Time limit exceeded0/3465ms27596 KiB
29Time limit exceeded0/3477ms27500 KiB
30Time limit exceeded0/3462ms27564 KiB