結果

問題 No.629 グラフの中に眠る門松列
ユーザー totori_nyaatotori_nyaa
提出日時 2019-07-17 21:40:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 1,575 ms
コンパイル使用メモリ 168,140 KB
実行使用メモリ 5,860 KB
最終ジャッジ日時 2023-08-24 22:59:13
合計ジャッジ時間 3,004 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,620 KB
testcase_01 AC 3 ms
5,612 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 4 ms
5,540 KB
testcase_05 WA -
testcase_06 AC 3 ms
5,556 KB
testcase_07 AC 4 ms
5,712 KB
testcase_08 WA -
testcase_09 AC 3 ms
5,724 KB
testcase_10 AC 3 ms
5,660 KB
testcase_11 AC 3 ms
5,688 KB
testcase_12 AC 3 ms
5,704 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 3 ms
5,604 KB
testcase_16 AC 4 ms
5,516 KB
testcase_17 AC 4 ms
5,532 KB
testcase_18 AC 4 ms
5,636 KB
testcase_19 AC 3 ms
5,596 KB
testcase_20 AC 4 ms
5,636 KB
testcase_21 WA -
testcase_22 AC 5 ms
5,712 KB
testcase_23 AC 5 ms
5,636 KB
testcase_24 AC 3 ms
5,688 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 3 ms
5,656 KB
testcase_28 WA -
testcase_29 AC 3 ms
5,600 KB
testcase_30 AC 4 ms
5,556 KB
testcase_31 AC 4 ms
5,584 KB
testcase_32 AC 4 ms
5,536 KB
testcase_33 WA -
testcase_34 AC 4 ms
5,616 KB
testcase_35 AC 3 ms
5,516 KB
testcase_36 AC 3 ms
5,592 KB
testcase_37 WA -
testcase_38 AC 4 ms
5,600 KB
testcase_39 AC 3 ms
5,468 KB
testcase_40 WA -
testcase_41 AC 4 ms
5,712 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<n-1;i++){
        int a,b;
        cin>>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[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