87892024-01-30 11:48:04Leventusz09Utazásszervezés (75 pont)csharpRuntime error 4/7541ms26804 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();
            //Array.Sort(Ig);

            int temp = N;
            int o1 = 0;
            int[] ret = new int[K];

            for(int i=0, j; i<C; i++){
                if(temp > 0){
                    o1++;
                    temp--;
                    if (Ig[i] + M < K) ret[Ig[i]-1 + M]++;
                }
                if(i>0) for(j=Ig[i-1]-1; j <Ig[i]-1; j++) temp+=ret[Ig[j]-1];
            }
            Console.WriteLine(o1);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base4/75
1Accepted0/032ms22056 KiB
2Runtime error0/041ms24060 KiB
3Runtime error0/332ms22208 KiB
4Runtime error0/432ms22416 KiB
5Accepted4/430ms23696 KiB
6Runtime error0/434ms22980 KiB
7Runtime error0/432ms23100 KiB
8Runtime error0/435ms24136 KiB
9Runtime error0/535ms24400 KiB
10Runtime error0/535ms24544 KiB
11Runtime error0/635ms24668 KiB
12Runtime error0/637ms25440 KiB
13Runtime error0/639ms25636 KiB
14Wrong answer0/639ms26804 KiB
15Runtime error0/641ms26064 KiB
16Runtime error0/641ms26388 KiB
17Runtime error0/641ms26800 KiB