結果

問題 No.408 五輪ピック
ユーザー uenokuuenoku
提出日時 2017-01-15 02:07:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,358 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 80,316 KB
実行使用メモリ 9,992 KB
最終ジャッジ日時 2023-08-23 10:53:44
合計ジャッジ時間 2,626 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,344 KB
testcase_01 AC 4 ms
8,064 KB
testcase_02 AC 5 ms
8,076 KB
testcase_03 AC 4 ms
8,224 KB
testcase_04 AC 4 ms
8,352 KB
testcase_05 AC 26 ms
9,280 KB
testcase_06 AC 19 ms
8,888 KB
testcase_07 AC 26 ms
9,212 KB
testcase_08 AC 22 ms
8,880 KB
testcase_09 AC 23 ms
8,992 KB
testcase_10 AC 19 ms
8,988 KB
testcase_11 AC 18 ms
8,712 KB
testcase_12 AC 30 ms
9,220 KB
testcase_13 AC 25 ms
9,248 KB
testcase_14 AC 9 ms
8,544 KB
testcase_15 AC 26 ms
9,340 KB
testcase_16 AC 28 ms
9,144 KB
testcase_17 AC 29 ms
9,220 KB
testcase_18 AC 32 ms
9,332 KB
testcase_19 AC 34 ms
9,528 KB
testcase_20 AC 11 ms
8,572 KB
testcase_21 AC 8 ms
8,488 KB
testcase_22 AC 18 ms
8,784 KB
testcase_23 AC 39 ms
9,992 KB
testcase_24 WA -
testcase_25 AC 25 ms
9,632 KB
testcase_26 AC 35 ms
9,576 KB
testcase_27 AC 26 ms
9,524 KB
testcase_28 AC 20 ms
8,832 KB
testcase_29 AC 21 ms
8,812 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define mp make_pair
using namespace std;
typedef long long int lli;
lli MOD = 1000000007;
vector<int> e[100005];
vector<int> p[100005];
int f[100005];
int t[100005];

int main()
{
    int n, m;
    cin >> n >> m;
    int a, b;
    rep(i, m)
    {
        cin >> a >> b;
        a--, b--;
        e[a].push_back(b);
        e[b].push_back(a);
        f[i] = a, t[i] = b;
    }
    rep(i, e[0].size())
    {
        int in = e[0][i];
        rep(j, e[in].size())
        {
            if (e[in][j] != 0)
                p[e[in][j]].push_back(in);
        }
    }
    rep(i, m)
    {
        if (p[f[i]].size() == 0 || p[t[i]].size() == 0)
            continue;

        // if (p[f[i]].size() != p[t[i]].size()) {
        //     cout << "YES" << endl;
        //     return 0;
        // }
        bool flag[100005] = {};
        for (auto s : p[f[i]]) {
            flag[s] = true;
        }
        for (auto s : p[t[i]]) {
            if (!flag[s]) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
}
0