結果

問題 No.1373 Directed Operations
コンテスト
ユーザー tatt61880
提出日時 2021-02-28 21:00:33
言語 Kuin
(KuinC++ v.2021.9.17)
コンパイル:
kuinc -i _filename_ -o out.cpp -s /kuin/sys/ -e cpp -r -q
実行:
./a.out
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 731 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,630 ms
コンパイル使用メモリ 166,096 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2026-04-05 16:49:37
合計ジャッジ時間 5,171 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<k_ap>' [-Wnontrivial-memcall]
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
out.cpp:688:9: note: in instantiation of function template specialization 'newArraysRec_<std::shared_ptr<Array_<std::shared_ptr<k_ap>>>>::operator()<long long>' requested here
  688 |         return newArraysRec_<T>()(std::forward<A>(a)...);
      |                ^
out.cpp:1641:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<k_ap>>>, long long>' requested here
 1641 | (k_ao) = (newArrays_<type_(Array_<type_(k_ap)>)>(((k_am) - (1LL))));
      |           ^
out.cpp:676:14: note: explicitly cast the pointer to silence this warning
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
      |                                (void*)
1 warning generated.

ソースコード

diff #
raw source code

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