46182023-03-30 12:20:28TortelliniJrLeghosszabb nyaralás (75 pont)csharpWrong answer 0/75268ms39348 KiB
using System;
using System.Linq;
namespace LeghNyar
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] arak = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int legt = 0;
            int jelp = inp[1];
            for (int i = 0; i < inp[0]; i++)
            {
                for (int u = 0; u < inp[0] - i; u++)
                {
                    if (arak[i + u] > jelp && u + 1 > legt)
                    {
                        legt = u + 1;
                        jelp = inp[1];
                        break;
                    }
                    else if (arak[i + u] > jelp)
                    {
                        break;
                    }
                    jelp -= arak[i + u];
                }
            }
            Console.WriteLine(legt);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Accepted0/030ms21852 KiB
2Wrong answer0/085ms36352 KiB
3Wrong answer0/329ms22732 KiB
4Wrong answer0/329ms23204 KiB
5Wrong answer0/330ms23572 KiB
6Wrong answer0/329ms24268 KiB
7Wrong answer0/329ms23852 KiB
8Wrong answer0/429ms24268 KiB
9Wrong answer0/435ms25500 KiB
10Wrong answer0/535ms25456 KiB
11Wrong answer0/539ms26664 KiB
12Wrong answer0/539ms26932 KiB
13Time limit exceeded0/7268ms13232 KiB
14Wrong answer0/779ms38084 KiB
15Wrong answer0/782ms39348 KiB
16Wrong answer0/883ms38720 KiB
17Wrong answer0/882ms39152 KiB