結果
| 問題 | No.812 Change of Class |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-13 00:31:52 |
| 言語 | Kuin (KuinC++ v.2021.9.17) |
| 結果 |
AC
|
| 実行時間 | 305 ms / 4,000 ms |
| コード長 | 1,358 bytes |
| 記録 | |
| コンパイル時間 | 1,894 ms |
| コンパイル使用メモリ | 174,088 KB |
| 実行使用メモリ | 28,544 KB |
| 最終ジャッジ日時 | 2026-04-05 14:58:24 |
| 合計ジャッジ時間 | 9,841 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 60 |
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<List_<long>>' [-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<List_<long>>>>>::operator()<long>' requested here
688 | return newArraysRec_<T>()(std::forward<A>(a)...);
| ^
out.cpp:1649:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<List_<long>>>>, long>' requested here
1649 | (k_au) = (newArrays_<type_(Array_<type_(List_<int64_t>)>)>((k_ap)));
| ^
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*)
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<Array_<long>>' [-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_<long>>>>>::operator()<long>' requested here
688 | return newArraysRec_<T>()(std::forward<A>(a)...);
| ^
out.cpp:1660:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<Array_<long>>>>, long>' requested here
1660 | (k_bk) = (newArrays_<type_(Array_<type_(Array_<int64_t>)>)>((k_ap)));
| ^
out.cpp:676:14: note: explicitly cast the pointer
ソースコード
func main()
var ss: [][]char
do ss :: cui@input().split(" ")
var N: int :: ss[0].toInt(&)
var M: int :: ss[1].toInt(&)
var friendList: []list<int> :: #[N]list<int>
for i(0, N - 1)
do friendList[i] :: #list<int>
end for
for i(0, M - 1)
do ss :: cui@input().split(" ")
var p: int :: ss[0].toInt(&) - 1
var q: int :: ss[1].toInt(&) - 1
do friendList[p].add(q)
do friendList[q].add(p)
end for
var friendArray: [][]int :: #[N][]int
for i(0, N - 1)
do friendArray[i] :: friendList[i].toArray()
end for
var Q: int :: cui@input().toInt(&)
var que: queue<int> :: #queue<int>
var people: []int :: #[N]int
for(1, Q)
for i(0, N - 1)
do people[i] :: 0
end for
var A: int :: cui@input().toInt(&) - 1
do people[A] :: 1
do que.add(A)
var num: int :: 0
while(^que <> 0)
var p: int :: que.get()
for i(0, ^friendArray[p] - 1)
var f: int :: friendArray[p][i]
if(people[f] = 0)
do people[f] :: people[p] + 1
do num :+ 1
do que.add(f)
else
if(people[p] + 1 < people[f])
do people[f] :: people[p] + 1
end if
end if
end for
end while
var len: int :: 0
for i(0, N - 1)
if(people[i] > len)
do len :: people[i]
end if
end for
do len :- 1
var ans: int :: 0
while(2 ^ ans < len)
do ans :+ 1
end while
do cui@print("\{num} \{ans}\n")
end for
end func