92492024-02-19 11:32:19Leventusz09Utazásszervezés (75 pont)csharpWrong answer 4/7541ms28620 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Utazásszervezés{
    class Program{
        static void Main(){
            int[] in1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = in1[0],  //idegenvezetők
                K = in1[1],  //szezon
                M = in1[2],  //utazások hossza
                C = in1[3];  //utazások
            int[] Ig = Console.ReadLine().Split().Select(int.Parse).ToArray();
            /* V1 int temp = N;
            int o1 = 0;
            int[] ret = new int[K];

            for (int i = 0, j; i < C; i++){
                if (i > 0) for (j = Ig[i - 1] - 1; j < Ig[i] - 1; j++) temp += ret[j];
                if (temp > 0){
                    o1++;
                    temp--;
                    if (Ig[i] - 1 + M < K) ret[Ig[i] - 1 + M]++;
                }
            }*/

            int o1 = 0;
            int n = N;
            int[] b = new int[K];
            for(int i=0; i<C; i++){
                if(i>0) for(int j=Ig[i-1]; j<Ig[i]; j++) n += b[j-1];
                if (n > 0){
                    o1++;
                    n--;
                    if(i+M<C) b[i+M]++;
                }
            }

            Console.WriteLine(o1);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base4/75
1Accepted0/032ms22036 KiB
2Wrong answer0/041ms24932 KiB
3Wrong answer0/330ms23212 KiB
4Wrong answer0/429ms22972 KiB
5Accepted4/430ms23392 KiB
6Wrong answer0/429ms23480 KiB
7Wrong answer0/430ms23648 KiB
8Wrong answer0/435ms24716 KiB
9Wrong answer0/535ms25180 KiB
10Wrong answer0/539ms25532 KiB
11Wrong answer0/639ms26424 KiB
12Wrong answer0/641ms27088 KiB
13Wrong answer0/641ms27296 KiB
14Wrong answer0/641ms27796 KiB
15Wrong answer0/641ms28108 KiB
16Wrong answer0/641ms28620 KiB
17Wrong answer0/641ms28564 KiB