結果

問題 No.629 グラフの中に眠る門松列
ユーザー TamuoTamuoTamuoTamuoTamuoTamuo
提出日時 2019-06-25 21:08:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,355 bytes
コンパイル時間 1,613 ms
コンパイル使用メモリ 171,552 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-05 12:06:22
合計ジャッジ時間 3,254 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define SPACEREP(lst,itr) for(auto itr=lst.begin(); itr!=lst.end();++itr){cout<<*itr<<(++itr!=anslist.end()?" ":"\n");itr--;}
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
    int N,M;
    cin >> N >> M;
    vector<vector<pair<int,int>>> edge(N+1);
    vector<int> value(N+1);

    int u,v;
    REP(i,1,N+1){
        cin >> value[i];
    }
    REP(i,1,M+1){
        cin >> u >> v;
        if(value[u]-value[v]==0)continue;
        edge[u].push_back(make_pair(v,value[u]-value[v]));
        edge[v].push_back(make_pair(u,value[v]-value[u]));
    }

    bool flag=false;
    REP(i,1,N+1){
        for(auto x : edge[i]){
            for(auto y : edge[i]){
                if(x.first==y.first)continue;
                if(x.second==y.second)continue;
                if(x.second<0 && y.second>0)continue;
                if(x.second>0 && y.second<0)continue;
                flag=true;
            }
        }
    }

    cout << (flag ? "Yes" : "No") << endl;
}
0