import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets import critbits, future, strformat, deques template `max=`(x,y) = x = max(x,y) template `min=`(x,y) = x = min(x,y) template `mod=`(x,y) = x = x mod y template scan2 = (scan(), scan()) template scan3 = (scan(), scan()) let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) proc scan(): int = read().parseInt proc scanf(): float = read().parseFloat proc toInt(c:char): int = return int(c) - int('0') proc solve()= var n = scan() x = scan() y = scan() a = newseqwith(n,scan()) ax = newseqwith(n,0) cx = newseqwith(n,0) minIdxX = newseqwith(n+1,0) choicex = newseqwith(n,newseq[int](3)) ay = newseqwith(n,0) cy = newseqwith(n,0) minIdxY = newseqwith(n+1,0) choicey = newseqwith(n,newseq[int](3)) # i番目の要素をx,yに置き換えたときのうれしさ for i in 0.. cx[i]: minIdxX[i] = i else: minIdxX[i] = minIdxX[i-1] for i in countdown(n-1,0): if cy[minIdxY[i+1]] > cy[i]: minIdxY[i] = i else: minIdxY[i] = minIdxY[i+1] #echo a #echo "x" #echo cx #echo minIdxX #echo "y" #echo ay #echo cy #echo minIdxY #echo "" # choicex[i] # 0: [0..i-1]での最大値 # 1: [?..i]での最大値: # : 最小値のインデックスだけ保持しておけばよさそう # 2: [i..i]の値 choicex[0][0] = cx[1] choicex[0][1] = cx[1] choicex[0][2] = cx[1] for m in 1..