結果

問題 No.629 グラフの中に眠る門松列
ユーザー Konton7Konton7
提出日時 2020-02-07 23:48:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,212 bytes
コンパイル時間 2,602 ms
コンパイル使用メモリ 209,032 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-26 00:11:45
合計ジャッジ時間 4,462 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 3 ms
4,348 KB
testcase_22 AC 3 ms
4,348 KB
testcase_23 AC 3 ms
4,348 KB
testcase_24 AC 3 ms
4,348 KB
testcase_25 WA -
testcase_26 AC 4 ms
4,348 KB
testcase_27 AC 4 ms
4,348 KB
testcase_28 WA -
testcase_29 AC 4 ms
4,348 KB
testcase_30 AC 4 ms
4,348 KB
testcase_31 AC 4 ms
4,348 KB
testcase_32 AC 4 ms
4,348 KB
testcase_33 WA -
testcase_34 AC 3 ms
4,348 KB
testcase_35 AC 3 ms
4,348 KB
testcase_36 AC 4 ms
4,348 KB
testcase_37 WA -
testcase_38 AC 4 ms
4,348 KB
testcase_39 AC 3 ms
4,348 KB
testcase_40 WA -
testcase_41 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


struct node
{
    int point;
    set<int> lt_point;
    set<int> gt_point;
};

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, m, s, t;
    cin >> n >> m;
    node nodes[n];
    bool ans = false;

    rep(i, n)
        cin >> nodes[i].point;
    rep(i, m)
    {
        cin >> s >> t;
        s--, t--;

        if (nodes[s].point < nodes[t].point)
        {
            nodes[s].gt_point.insert(nodes[t].point);
            nodes[t].lt_point.insert(nodes[s].point);
        }
        else
        {
            nodes[s].lt_point.insert(nodes[t].point);
            nodes[t].gt_point.insert(nodes[s].point);
        }
    }
    rep(i, n)
    {
        if (nodes[i].gt_point.size() >= 2)
            ans = true;
        if (nodes[i].lt_point.size() >= 2)
            ans = true;
    }
    
    cout << ( ans ? "YES" : "NO" ) << endl;
    return 0;
}
0