結果

問題 No.2072 Anatomy
ユーザー suisui
提出日時 2022-09-16 22:27:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,397 bytes
コンパイル時間 4,287 ms
コンパイル使用メモリ 264,760 KB
実行使用メモリ 9,692 KB
最終ジャッジ日時 2023-08-23 16:05:27
合計ジャッジ時間 8,195 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 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 113 ms
8,260 KB
testcase_10 AC 108 ms
7,760 KB
testcase_11 WA -
testcase_12 AC 88 ms
7,744 KB
testcase_13 WA -
testcase_14 AC 75 ms
6,352 KB
testcase_15 AC 70 ms
6,420 KB
testcase_16 WA -
testcase_17 AC 114 ms
8,336 KB
testcase_18 AC 60 ms
6,024 KB
testcase_19 AC 120 ms
8,744 KB
testcase_20 WA -
testcase_21 AC 118 ms
8,532 KB
testcase_22 WA -
testcase_23 AC 119 ms
8,616 KB
testcase_24 AC 114 ms
8,620 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 119 ms
8,776 KB
testcase_28 AC 117 ms
8,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(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 (ll i = (ll)(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<ll,ll>;
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(){
    ll n,m;
    cin >> n >> m;
    vector<P> uv;
    rep(i,m){
        ll u,v;
        cin >> u >> v;
        u--; v--;
        uv.push_back({u,v});
    }
    dsu d(n);
    vector<ll> ans(n,0);
    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);
        ans[d.leader(uv[i].first)] = max(ans[d.leader(uv[i].first)] ,ans[d.leader(uv[i].second)])+1;
    }
    cout << *max_element(all(ans)) << endl;
    return 0;
}
0