87882024-01-30 11:46:39Leventusz09Utazásszervezés (75 pont)csharpRuntime error 4/7541ms27668 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]-1 + 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/030ms22208 KiB
2Runtime error0/039ms24000 KiB
3Runtime error0/334ms22360 KiB
4Runtime error0/432ms22528 KiB
5Accepted4/429ms23452 KiB
6Runtime error0/434ms23040 KiB
7Runtime error0/432ms23124 KiB
8Runtime error0/435ms24068 KiB
9Runtime error0/537ms24356 KiB
10Runtime error0/537ms25172 KiB
11Runtime error0/637ms25404 KiB
12Runtime error0/639ms26060 KiB
13Runtime error0/639ms25816 KiB
14Wrong answer0/641ms27668 KiB
15Runtime error0/641ms26784 KiB
16Runtime error0/641ms26612 KiB
17Runtime error0/641ms26964 KiB