95052024-02-22 12:35:53Leventusz09Vásárlás (75 pont)csharpTime limit exceeded 15/75455ms24928 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Vásárlás{
    class Program{
        static void Main(){
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray(),
                  B = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int o1 = int.MaxValue;

            for(int i=-1, to, j, k; i<N; i++){
                for(j=-1; j<N; j++){
                    to = 0;
                    for(k=0; k<N; k++){
                        if (i <= k && k <= j) to += A[k];
                        else to += B[k];
                    }
                    if (to < o1) o1 = to;
                }
            }
            Console.WriteLine(o1);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base15/75
1Accepted0/032ms22028 KiB
2Time limit exceeded0/0370ms11676 KiB
3Accepted3/330ms22984 KiB
4Accepted4/430ms23196 KiB
5Accepted4/435ms23540 KiB
6Accepted4/435ms23864 KiB
7Time limit exceeded0/4365ms6492 KiB
8Time limit exceeded0/3372ms6428 KiB
9Time limit exceeded0/4372ms6956 KiB
10Time limit exceeded0/4381ms7032 KiB
11Time limit exceeded0/4384ms7040 KiB
12Time limit exceeded0/5388ms7496 KiB
13Time limit exceeded0/3370ms23792 KiB
14Time limit exceeded0/3455ms23856 KiB
15Time limit exceeded0/3368ms23780 KiB
16Time limit exceeded0/3391ms24108 KiB
17Time limit exceeded0/3367ms24396 KiB
18Time limit exceeded0/3367ms24496 KiB
19Time limit exceeded0/3386ms24132 KiB
20Time limit exceeded0/3379ms24308 KiB
21Time limit exceeded0/3367ms24396 KiB
22Time limit exceeded0/3382ms22504 KiB
23Time limit exceeded0/3379ms24928 KiB
24Time limit exceeded0/3379ms24620 KiB