結果
問題 |
No.2289 順列ソート
|
ユーザー |
|
提出日時 | 2023-10-13 15:32:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 1,301 ms |
コンパイル使用メモリ | 102,544 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 12:01:02 |
合計ジャッジ時間 | 2,085 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream> #include <atcoder/dsu> int main() { std::cin.tie(nullptr) -> sync_with_stdio(false); int n; std::cin >> n; atcoder::dsu uf(n); for(int i = 0; i < n; ++i) { int p; std::cin >> p; uf.merge(i, --p); } std::cout << n - std::ssize(uf.groups()) << '\n'; }