結果

問題 No.1373 Directed Operations
ユーザー 👑 tatt61880tatt61880
提出日時 2021-02-28 21:00:33
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 731 bytes
コンパイル時間 2,771 ms
コンパイル使用メモリ 159,656 KB
実行使用メモリ 12,272 KB
最終ジャッジ日時 2023-10-14 17:30:37
合計ジャッジ時間 8,870 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 AC 197 ms
11,996 KB
testcase_03 AC 106 ms
12,184 KB
testcase_04 AC 118 ms
12,244 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 252 ms
12,120 KB
testcase_07 AC 7 ms
4,368 KB
testcase_08 AC 25 ms
4,704 KB
testcase_09 AC 173 ms
12,272 KB
testcase_10 AC 135 ms
10,824 KB
testcase_11 AC 31 ms
5,532 KB
testcase_12 AC 136 ms
10,428 KB
testcase_13 AC 16 ms
4,504 KB
testcase_14 AC 261 ms
12,244 KB
testcase_15 AC 224 ms
11,028 KB
testcase_16 AC 268 ms
12,060 KB
testcase_17 AC 155 ms
10,068 KB
testcase_18 AC 89 ms
7,312 KB
testcase_19 AC 95 ms
7,088 KB
testcase_20 AC 136 ms
8,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var lines: []Line :: #[n - 1]Line
	
	for id(0, n - 2)
		var len: int :: cui@inputInt()
		do lines[id] :: (#Line).init(id, len)
	end for
	do lines.sort()
	
	var ans: []int :: #[n - 1]int
	for i(0, n - 2)
		var id: int :: lines[i].id
		var len: int :: lines[i].len
		var a: int :: i + 2 - len
		if(a < 1)
			do cui@print("NO\n")
			ret
		end if
		do ans[id] :: a
	end for
	do cui@print("YES\n")
	for i(0, n - 2)
		do cui@print("\{ans[i]}\n")
	end for
	
	class Line()
		+var id: int
		+var len: int
		+func init(id: int, len: int): Line
			do me.id :: id
			do me.len :: len
			ret me
		end func
		+*func cmp(t: kuin@Class): int
			ret me.len - (t $ Line).len
		end func
	end class
end func
0