Submission #19680172


Source Code Expand

Copy
N,*A = $<.read.split.map(&:to_i)
A << 0
LD = [nil]*N
(0...N).each{|i|
a = A[i]
l = i-1
l = LD[l] until A[l] < a
LD[i] = l
}
RD = [nil]*N
(0...N).reverse_each{|i|
a = A[i]
r = i+1
r = RD[r] until A[r] < a
RD[i] = r
}
p (0...N).map{|i|
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
N,*A = $<.read.split.map(&:to_i)

A << 0

LD = [nil]*N
(0...N).each{|i|
	a = A[i]
	l = i-1
	l = LD[l] until A[l] < a
	LD[i] = l
}

RD = [nil]*N
(0...N).reverse_each{|i|
	a = A[i]
	r = i+1
	r = RD[r] until A[r] < a
	RD[i] = r
}

p (0...N).map{|i|
	A[i]*(RD[i]-LD[i]-1)
}.max

Submission Info

Submission Time
Task C - Mandarin Orange
User ds14050
Language Ruby (2.7.1)
Score 300
Code Size 297 Byte
Status AC
Exec Time 69 ms
Memory 15104 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 33
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All min_01.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
min_01.txt AC 62 ms 14184 KB
random_01.txt AC 67 ms 14784 KB
random_02.txt AC 67 ms 14744 KB
random_03.txt AC 68 ms 14880 KB
random_04.txt AC 65 ms 14776 KB
random_05.txt AC 63 ms 14704 KB
random_06.txt AC 69 ms 14844 KB
random_07.txt AC 67 ms 14736 KB
random_08.txt AC 64 ms 14844 KB
random_09.txt AC 68 ms 14988 KB
random_10.txt AC 66 ms 14820 KB
random_11.txt AC 61 ms 14848 KB
random_12.txt AC 68 ms 14864 KB
random_13.txt AC 63 ms 14604 KB
random_14.txt AC 63 ms 14692 KB
random_15.txt AC 67 ms 14928 KB
random_16.txt AC 64 ms 14796 KB
random_17.txt AC 67 ms 14560 KB
random_18.txt AC 69 ms 15068 KB
random_19.txt AC 67 ms 14936 KB
random_20.txt AC 64 ms 14684 KB
random_21.txt AC 67 ms 15032 KB
random_22.txt AC 61 ms 14704 KB
random_23.txt AC 64 ms 14880 KB
random_24.txt AC 64 ms 15036 KB
random_25.txt AC 64 ms 14776 KB
random_26.txt AC 66 ms 15104 KB
random_27.txt AC 66 ms 15028 KB
random_28.txt AC 66 ms 14752 KB
random_29.txt AC 65 ms 14888 KB
random_30.txt AC 66 ms 15008 KB
sample_01.txt AC 62 ms 14212 KB
sample_02.txt AC 58 ms 14204 KB


2025-04-05 (Sat)
20:01:51 +00:00