45412023-03-29 13:45:12Leventusz19Leghosszabb nyaralás (75 pont)csharpWrong answer 20/7585ms39368 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Leghoszabb_nyaralás
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] in1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = in1[0], P = in1[1];
            int o1 = 0;
            int Pn = 0;
            for(int i=0; i<N;){
                if (Pn < P) {
                    Pn += A[i]; i++;
                    o1++;
                }else{
                    Pn -= A[i - o1];
                    o1--;
                }
            }
            Console.WriteLine(o1);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base20/75
1Accepted0/032ms22032 KiB
2Wrong answer0/083ms36148 KiB
3Accepted3/332ms22584 KiB
4Accepted3/330ms23172 KiB
5Wrong answer0/330ms23756 KiB
6Accepted3/330ms23512 KiB
7Wrong answer0/330ms23868 KiB
8Accepted4/430ms23856 KiB
9Wrong answer0/435ms24940 KiB
10Wrong answer0/537ms24516 KiB
11Wrong answer0/539ms26020 KiB
12Wrong answer0/541ms26716 KiB
13Accepted7/776ms35680 KiB
14Wrong answer0/781ms37600 KiB
15Wrong answer0/782ms39108 KiB
16Wrong answer0/885ms38344 KiB
17Wrong answer0/883ms39368 KiB