1852021-02-03 23:37:16ncsZenehallgatásnimTime limit exceeded 15/50305ms23268 KiB
import strscans, strutils, sequtils, sugar, algorithm

var n,k:int
discard scanf(stdin.readLine(),"$i$s$i",n,k)
var T = stdin.readLine().split().map(x=>parseInt(x))
var P = stdin.readLine().split().map(x=>parseInt(x))

var s=0
for i in 0 ..< n:
  s += T[i]
  T[i] = s

for i in 0 ..< k:
  let p = P[i]
  if 0 == p:
    P[i]=1
    continue
  let r = p mod s
  if 0 == r:
    P[i]=n
    continue
  P[i]=lowerBound(T,r)+1 

P.join(" ").echo
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/02ms1984 KiB
2Time limit exceeded0/0294ms14724 KiB
3Accepted2/27ms3100 KiB
4Accepted2/27ms3036 KiB
5Accepted2/27ms2984 KiB
6Accepted3/36ms3164 KiB
7Accepted3/36ms3012 KiB
8Accepted3/36ms3016 KiB
9Time limit exceeded0/2298ms14884 KiB
10Time limit exceeded0/2282ms15120 KiB
11Time limit exceeded0/2298ms17364 KiB
12Time limit exceeded0/2296ms18584 KiB
13Time limit exceeded0/2289ms18468 KiB
14Time limit exceeded0/2298ms19120 KiB
15Time limit exceeded0/2291ms18992 KiB
16Time limit exceeded0/2300ms18688 KiB
17Time limit exceeded0/2298ms18772 KiB
18Time limit exceeded0/2280ms20916 KiB
19Time limit exceeded0/2284ms19572 KiB
20Time limit exceeded0/2273ms21700 KiB
21Time limit exceeded0/2284ms22628 KiB
22Time limit exceeded0/3305ms23000 KiB
23Time limit exceeded0/3291ms23236 KiB
24Time limit exceeded0/3298ms23268 KiB