結果
| 問題 |
No.629 グラフの中に眠る門松列
|
| コンテスト | |
| ユーザー |
TamuoTamuoTamuo
|
| 提出日時 | 2019-06-25 21:08:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,355 bytes |
| コンパイル時間 | 2,551 ms |
| コンパイル使用メモリ | 173,776 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-23 07:43:57 |
| 合計ジャッジ時間 | 2,989 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 6 |
| other | WA * 36 |
ソースコード
#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;
}
TamuoTamuoTamuo