結果

問題 No.2072 Anatomy
ユーザー norikamenorikame
提出日時 2022-09-17 01:00:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 789 bytes
コンパイル時間 4,466 ms
コンパイル使用メモリ 263,792 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-06-01 14:43:40
合計ジャッジ時間 8,288 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 111 ms
5,888 KB
testcase_09 AC 121 ms
6,144 KB
testcase_10 AC 117 ms
5,760 KB
testcase_11 AC 121 ms
6,144 KB
testcase_12 AC 94 ms
5,376 KB
testcase_13 AC 124 ms
6,400 KB
testcase_14 AC 80 ms
5,376 KB
testcase_15 AC 73 ms
5,376 KB
testcase_16 AC 124 ms
6,528 KB
testcase_17 AC 122 ms
6,272 KB
testcase_18 AC 62 ms
5,376 KB
testcase_19 AC 127 ms
6,528 KB
testcase_20 AC 128 ms
6,528 KB
testcase_21 AC 123 ms
6,528 KB
testcase_22 AC 127 ms
6,400 KB
testcase_23 AC 125 ms
6,528 KB
testcase_24 AC 121 ms
6,400 KB
testcase_25 AC 128 ms
6,528 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 126 ms
6,528 KB
testcase_28 AC 126 ms
6,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

using ll = long long;

#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i))
#define all(x) (x).begin(), (x).end()

const int INF = (int)(1e9);

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> u(m), v(m);
	rep(i, m) {
		cin >> u[i] >> v[i];
		u[i]--; v[i]--;
	}
	dsu d(n);
	vector<int> dcnt(n);
	repr(i, m) {
		int nval = max(dcnt[d.leader(u[i])], dcnt[d.leader(v[i])]) + 1;
		d.merge(u[i], v[i]);
		dcnt[d.leader(u[i])] = nval;
	}
	int res = *max_element(all(dcnt));
	cout << res << endl;
	return 0;
}
0