結果

問題 No.629 グラフの中に眠る門松列
ユーザー totori_nyaatotori_nyaa
提出日時 2019-07-17 21:44:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 4,000 ms
コード長 789 bytes
コンパイル時間 1,706 ms
コンパイル使用メモリ 168,996 KB
実行使用メモリ 5,884 KB
最終ジャッジ日時 2023-08-24 23:14:37
合計ジャッジ時間 3,445 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,724 KB
testcase_01 AC 3 ms
5,704 KB
testcase_02 AC 3 ms
5,732 KB
testcase_03 AC 3 ms
5,712 KB
testcase_04 AC 4 ms
5,560 KB
testcase_05 AC 3 ms
5,704 KB
testcase_06 AC 3 ms
5,496 KB
testcase_07 AC 3 ms
5,732 KB
testcase_08 AC 3 ms
5,580 KB
testcase_09 AC 3 ms
5,612 KB
testcase_10 AC 3 ms
5,532 KB
testcase_11 AC 4 ms
5,772 KB
testcase_12 AC 4 ms
5,632 KB
testcase_13 AC 3 ms
5,564 KB
testcase_14 AC 3 ms
5,632 KB
testcase_15 AC 3 ms
5,624 KB
testcase_16 AC 3 ms
5,560 KB
testcase_17 AC 4 ms
5,800 KB
testcase_18 AC 3 ms
5,772 KB
testcase_19 AC 3 ms
5,676 KB
testcase_20 AC 4 ms
5,704 KB
testcase_21 AC 4 ms
5,644 KB
testcase_22 AC 4 ms
5,712 KB
testcase_23 AC 4 ms
5,532 KB
testcase_24 AC 5 ms
5,532 KB
testcase_25 AC 5 ms
5,544 KB
testcase_26 AC 4 ms
5,816 KB
testcase_27 AC 4 ms
5,836 KB
testcase_28 AC 3 ms
5,600 KB
testcase_29 AC 5 ms
5,716 KB
testcase_30 AC 4 ms
5,700 KB
testcase_31 AC 5 ms
5,772 KB
testcase_32 AC 5 ms
5,636 KB
testcase_33 AC 5 ms
5,724 KB
testcase_34 AC 4 ms
5,560 KB
testcase_35 AC 3 ms
5,484 KB
testcase_36 AC 5 ms
5,800 KB
testcase_37 AC 4 ms
5,580 KB
testcase_38 AC 4 ms
5,884 KB
testcase_39 AC 5 ms
5,640 KB
testcase_40 AC 4 ms
5,704 KB
testcase_41 AC 3 ms
5,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
 
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<vector<int>> v(111111);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    bool pos=false;
    for(int i=0;i<1111;i++){
        for(auto j:v[i]){
            for(auto k:v[j]){
                if(k==i) continue;
                if(a[i]==a[k]) continue;
                if(a[i]<a[j] && a[j]>a[k]) pos=true;
                if(a[i]>a[j] && a[k]>a[j]) pos=true;
            }
        }
    }
    if(pos){
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
}
0