結果
| 問題 | No.199 星を描こう |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-11 00:19:24 |
| 言語 | Kuin (KuinC++ v.2021.9.17) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,172 bytes |
| 記録 | |
| コンパイル時間 | 1,689 ms |
| コンパイル使用メモリ | 160,872 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-05 17:51:54 |
| 合計ジャッジ時間 | 2,702 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<k_an>' [-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_an>>>>::operator()<long long>' requested here
688 | return newArraysRec_<T>()(std::forward<A>(a)...);
| ^
out.cpp:1635:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<k_an>>>, long long>' requested here
1635 | (k_am) = (newArrays_<type_(Array_<type_(k_an)>)>((5LL)));
| ^
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.
ソースコード
func main()
var p: []@Point :: #[5]@Point
for i(0, 4)
var x: int :: cui@inputInt()
var y: int :: cui@inputInt()
do p[i] :: (#@Point).init(x, y)
end for
var ans: bool :: ^@convexHull(p) = 6
do cui@print((ans ?("YES", "NO")) ~ "\n")
end func
class Point()
+var x: int
+var y: int
+func init(x: int, y: int): Point
do me.x :: x
do me.y :: y
ret me
end func
+func cross(a: Point, b: Point): int
ret(a.x - me.x) * (b.y - me.y) - (a.y - me.y) * (b.x - me.x)
end func
+*func cmp(t: kuin@Class): int
if(me.x < (t $ Point).x)
ret - 1
elif(me.x > (t $ Point).x)
ret 1
elif(me.y < (t $ Point).y)
ret - 1
elif(me.y > (t $ Point).y)
ret 1
end if
ret 0
end func
end class
func convexHull(p: []@Point): []@Point
var n: int :: ^p
var k: int :: 0
var res: []@Point :: #[n + 1]@Point
do p.sort()
for i(0, n - 1)
while(k >= 2 & res[k - 2].cross(res[k - 1], p[i]) <= 0)
do k :- 1
end while
do res[k] :: p[i]
do k :+ 1
end for
var t: int :: k + 1
for i(n - 2, 0, -1)
while(k >= t & res[k - 2].cross(res[k - 1], p[i]) <= 0)
do k :- 1
end while
do res[k] :: p[i]
do k :+ 1
end for
ret res.sub(0, k)
end func