結果

問題 No.2072 Anatomy
ユーザー suisui
提出日時 2022-09-16 22:23:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,472 bytes
コンパイル時間 4,320 ms
コンパイル使用メモリ 265,572 KB
実行使用メモリ 6,452 KB
最終ジャッジ日時 2023-08-23 16:02:37
合計ジャッジ時間 7,920 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 108 ms
5,836 KB
testcase_10 AC 106 ms
5,524 KB
testcase_11 WA -
testcase_12 AC 86 ms
5,060 KB
testcase_13 WA -
testcase_14 AC 70 ms
5,040 KB
testcase_15 AC 66 ms
4,820 KB
testcase_16 WA -
testcase_17 AC 109 ms
6,156 KB
testcase_18 AC 57 ms
4,908 KB
testcase_19 AC 116 ms
6,180 KB
testcase_20 WA -
testcase_21 AC 112 ms
6,352 KB
testcase_22 WA -
testcase_23 AC 113 ms
6,232 KB
testcase_24 AC 111 ms
6,104 KB
testcase_25 WA -
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 113 ms
6,116 KB
testcase_28 AC 114 ms
6,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n+1); i++)
#define repn(i,a,b) for (int i = (int)(a) ; i < (int)(b+1); i++)
#define repv(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define cauto const auto&
#define bit(n) (1LL<<(n))
#define uni(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using P = pair<int,int>;
using PP = pair<int, P>;
using Graph = vector<vector<int>>;
using mint = modint998244353;
#ifdef LOCAL
    #include <debug.hpp>
    #define debug(...) debug::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
    #define debug(...) (static_cast<void>(0))
#endif

int main(){
    int n,m;
    cin >> n >> m;
    vector<P> uv;
    rep(i,m){
        int u,v;
        cin >> u >> v;
        u--; v--;
        uv.push_back({u,v});
    }
    dsu d(n);
    vector<int> ans(n);
    repv(i,m){
        if(d.same(uv[i].first,uv[i].second)){
            ans[d.leader(uv[i].first)]++;
            continue;
        }
        d.merge(uv[i].first,uv[i].second);
        int tmp = max(ans[d.leader(uv[i].first)] ,ans[d.leader(uv[i].second)]);
        ans[d.leader(uv[i].first)] = tmp+1;
        ans[d.leader(uv[i].second)] = tmp+1;
    }
    cout << *max_element(all(ans)) << endl;
    return 0;
}
0