結果
| 問題 | No.157 2つの空洞 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-21 11:45:31 |
| 言語 | Kuin (KuinC++ v.2021.9.17) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,268 bytes |
| 記録 | |
| コンパイル時間 | 1,606 ms |
| コンパイル使用メモリ | 168,776 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-05 17:07:42 |
| 合計ジャッジ時間 | 2,180 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<Array_<char16_t>>' [-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<Array_<char16_t>>>>>::operator()<long>' requested here
688 | return newArraysRec_<T>()(std::forward<A>(a)...);
| ^
out.cpp:1639:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<Array_<char16_t>>>>, long>' requested here
1639 | (k_ap) = (newArrays_<type_(Array_<type_(Array_<char16_t>)>)>((k_ao)));
| ^
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 w: int :: cui@inputInt()
var h: int :: cui@inputInt()
var c: [][]char :: #[h][]char
for i(0, h - 1)
do c[i] :: cui@input()
end for
const ch: char :: 'a'
var flag: bool :: true
var ans: int :: w + h
for y(0, h - 1)
for x(0, w - 1)
if(c[y][x] = '.')
if(flag)
var dx: []int :: [1, 0, -1, 0]
var dy: []int :: [0, 1, 0, -1]
var qu: queue<int> :: #queue<int>
do qu.add(y * w + x)
while loop(^qu <> 0)
var pos: int :: qu.get()
var cy: int :: pos / w
var cx: int :: pos % w
if(c[cy][cx] <> '.')
skip loop
end if
do c[cy][cx] :: ch
for i(0, 3)
var nx: int :: cx + dx[i]
if(nx < 0 | w <= nx)
skip i
end if
var ny: int :: cy + dy[i]
if(ny < 0 | h <= ny)
skip i
end if
if(c[ny][nx] = '.')
do qu.add(ny * w + nx)
end if
end for
end while
do flag :: false
else
for dy(-y, h - 1 - y)
var ny: int :: y + dy
for dx(-x, w - 1 - x)
var nx: int :: x + dx
if(c[ny][nx] = ch)
do ans :: [ans, dx.abs() + dy.abs() - 1].min()
end if
end for
end for
end if
end if
end for
end for
do cui@print("\{ans}\n")
end func