18282022-12-04 14:37:09KovácsHunorZenehallgatáscpp11Time limit exceeded 0/50300ms4512 KiB
#include "stdio.h"
#include "stdlib.h"



int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    int* length = (int*)malloc(sizeof(int)*n);
    int* time = (int*)malloc(sizeof(int)*n);
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", length + i);
        sum += length[i];
    }
    for (int i = 0; i < k; i++)
    {
        scanf("%d", time + i);
    }

    int point = 0;
    int j = 0;
    for (int i = 0; i < k; i++)
    {
        if(time[i-1] % sum >= time[i] % sum){
            j = 0;
            point = time[i] % sum;
        }
        else{
            point = time[i] % sum - time[i-1] % sum;
        }
        while(length[j] < point){
            point -= length[j];
            j++;
        }
        printf("%d ", j+1);
    }
    
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms1236 KiB
2Time limit exceeded0/0300ms1924 KiB
3Wrong answer0/23ms1716 KiB
4Wrong answer0/23ms1924 KiB
5Wrong answer0/23ms1776 KiB
6Wrong answer0/33ms2112 KiB
7Wrong answer0/33ms2084 KiB
8Wrong answer0/33ms2248 KiB
9Time limit exceeded0/2300ms2712 KiB
10Time limit exceeded0/2252ms2836 KiB
11Time limit exceeded0/2277ms2944 KiB
12Time limit exceeded0/2256ms3124 KiB
13Time limit exceeded0/2252ms3048 KiB
14Time limit exceeded0/2264ms3484 KiB
15Time limit exceeded0/2268ms3616 KiB
16Time limit exceeded0/2256ms3596 KiB
17Time limit exceeded0/2240ms3540 KiB
18Time limit exceeded0/2247ms3572 KiB
19Time limit exceeded0/2268ms3860 KiB
20Time limit exceeded0/2263ms3976 KiB
21Time limit exceeded0/2263ms4292 KiB
22Time limit exceeded0/3252ms4252 KiB
23Time limit exceeded0/3247ms4260 KiB
24Time limit exceeded0/3272ms4512 KiB