結果
| 問題 |
No.629 グラフの中に眠る門松列
|
| コンテスト | |
| ユーザー |
totori_nyaa
|
| 提出日時 | 2019-07-17 21:40:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 731 bytes |
| コンパイル時間 | 1,459 ms |
| コンパイル使用メモリ | 172,036 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-23 09:24:46 |
| 合計ジャッジ時間 | 2,593 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 28 WA * 8 |
ソースコード
#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;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;
}
totori_nyaa