結果

問題 No.1563 Same Degree
ユーザー ooooobaoooooba
提出日時 2021-08-04 21:52:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 996 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 126,396 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-14 21:26:06
合計ジャッジ時間 3,330 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 32 ms
4,348 KB
testcase_02 AC 31 ms
4,352 KB
testcase_03 AC 30 ms
4,348 KB
testcase_04 AC 32 ms
4,348 KB
testcase_05 AC 32 ms
4,352 KB
testcase_06 AC 36 ms
4,352 KB
testcase_07 AC 35 ms
4,348 KB
testcase_08 AC 36 ms
4,352 KB
testcase_09 AC 35 ms
4,352 KB
testcase_10 AC 36 ms
4,352 KB
testcase_11 AC 13 ms
4,352 KB
testcase_12 AC 27 ms
4,356 KB
testcase_13 AC 72 ms
4,352 KB
testcase_14 AC 82 ms
4,352 KB
testcase_15 AC 56 ms
4,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int32_t t;
    cin >> t;
    vector<bool> ans(t);
    for (auto i = 0; i < t; ++i) {
        int32_t n, m;
        cin >> n >> m;
        vector<int32_t> degs(n);
        for (auto j = 0; j < m; ++j) {
            int32_t u, v;
            cin >> u >> v;
            --u;
            --v;
            ++degs[u];
            ++degs[v];
        }
        unordered_map<int32_t, int32_t> hist;
        for (auto deg : degs) {
            ++hist[deg];
        }
        for (auto [k, v] : hist) {
            if (v >= 2) {
                ans[i] = true;
            }
        }
    }
    for (auto a : ans) {
        cout << (a ? "Yes" : "No") << endl;
    }
    return 0;
}
0