提出 #43911137


ソースコード 拡げる

N,M,*A = $<.read.split.map(&:to_i)

B = []
T = A.tally
I = [nil]*(M+1)
i = 0
A.each{|a|
	t = T[a] -= 1
	if 0<=t
		if ! I[a]
			I[B.pop] = nil while i<B.size && a<B[-1]
			I[a] = B.size
			B<<a
		end
	end
	if t==0
		i = I[a]+1 if i<=I[a]
	end
}

puts B*' '

提出情報

提出日時
問題 G - Minimum Permutation
ユーザ ds14050
言語 Ruby (2.7.1)
得点 600
コード長 277 Byte
結果 AC
実行時間 278 ms
メモリ 45832 KiB

ジャッジ結果

セット名 Sample All AfterContest
得点 / 配点 0 / 0 600 / 600 0 / 0
結果
AC × 3
AC × 47
AC × 1
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_max_03.txt, 01_max_04.txt, 01_max_05.txt, 01_max_06.txt, 01_max_07.txt, 01_max_08.txt, 01_max_09.txt, 01_max_10.txt, 01_max_11.txt, 01_max_12.txt, 01_max_13.txt, 01_max_14.txt, 01_max_15.txt, 01_max_16.txt, 01_max_17.txt, 01_max_18.txt, 01_max_19.txt, 01_max_20.txt, 01_max_21.txt, 01_max_22.txt, 02_random_23.txt, 02_random_24.txt, 02_random_25.txt, 02_random_26.txt, 02_random_27.txt, 02_random_28.txt, 02_random_29.txt, 02_random_30.txt, 02_random_31.txt, 02_random_32.txt, 02_random_33.txt, 02_random_34.txt, 02_random_35.txt, 02_random_36.txt, 02_random_37.txt, 02_random_38.txt, 03_handmade_39.txt, 03_handmade_40.txt, 03_handmade_41.txt, 03_handmade_42.txt, 03_handmade_43.txt, 03_handmade_44.txt, 03_handmade_45.txt, 03_handmade_46.txt
AfterContest 04_after_contest_47.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 60 ms 14184 KiB
00_sample_01.txt AC 61 ms 14192 KiB
00_sample_02.txt AC 55 ms 14080 KiB
01_max_03.txt AC 133 ms 27856 KiB
01_max_04.txt AC 140 ms 27916 KiB
01_max_05.txt AC 138 ms 27996 KiB
01_max_06.txt AC 140 ms 27900 KiB
01_max_07.txt AC 138 ms 27868 KiB
01_max_08.txt AC 159 ms 28152 KiB
01_max_09.txt AC 160 ms 28196 KiB
01_max_10.txt AC 158 ms 28300 KiB
01_max_11.txt AC 159 ms 28232 KiB
01_max_12.txt AC 154 ms 28360 KiB
01_max_13.txt AC 206 ms 37436 KiB
01_max_14.txt AC 209 ms 37504 KiB
01_max_15.txt AC 210 ms 37272 KiB
01_max_16.txt AC 207 ms 37404 KiB
01_max_17.txt AC 205 ms 37292 KiB
01_max_18.txt AC 238 ms 45524 KiB
01_max_19.txt AC 239 ms 45536 KiB
01_max_20.txt AC 258 ms 45644 KiB
01_max_21.txt AC 275 ms 45592 KiB
01_max_22.txt AC 278 ms 45804 KiB
02_random_23.txt AC 137 ms 27968 KiB
02_random_24.txt AC 141 ms 27792 KiB
02_random_25.txt AC 141 ms 27764 KiB
02_random_26.txt AC 164 ms 28156 KiB
02_random_27.txt AC 163 ms 28108 KiB
02_random_28.txt AC 164 ms 28168 KiB
02_random_29.txt AC 109 ms 21408 KiB
02_random_30.txt AC 175 ms 32332 KiB
02_random_31.txt AC 147 ms 26676 KiB
02_random_32.txt AC 159 ms 29376 KiB
02_random_33.txt AC 178 ms 31876 KiB
02_random_34.txt AC 53 ms 14220 KiB
02_random_35.txt AC 135 ms 25920 KiB
02_random_36.txt AC 59 ms 14084 KiB
02_random_37.txt AC 146 ms 28388 KiB
02_random_38.txt AC 104 ms 21116 KiB
03_handmade_39.txt AC 57 ms 14360 KiB
03_handmade_40.txt AC 134 ms 28260 KiB
03_handmade_41.txt AC 170 ms 33600 KiB
03_handmade_42.txt AC 196 ms 37516 KiB
03_handmade_43.txt AC 246 ms 45832 KiB
03_handmade_44.txt AC 56 ms 14168 KiB
03_handmade_45.txt AC 58 ms 14152 KiB
03_handmade_46.txt AC 131 ms 27692 KiB
04_after_contest_47.txt AC 196 ms 37520 KiB