結果
| 問題 | No.408 五輪ピック |
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2016-10-20 21:40:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,056 bytes |
| 記録 | |
| コンパイル時間 | 1,618 ms |
| コンパイル使用メモリ | 159,964 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-11-22 16:52:37 |
| 合計ジャッジ時間 | 2,767 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
using ll = long long;
using P = std::tuple<int,int>;
const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
int N, M;
vector<int> G[20000];
bool used[20000];
int can(int u, int n){
bool f = false;
for(int v : G[u]){
if(v == 0 && n == 5){return true;}
if(!used[v]){
used[v] = true;
// std::cout << "-> " << v << std::endl;
f = f || can(v, n + 1);
}
}
return f;
}
int main(){
//*
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
/*/
/*/
std::cin >> N >> M;
for(int i=0;i<M;++i){
int A, B;
std::cin >> A >> B;
--A; --B;
G[A].emplace_back(B);
G[B].emplace_back(A);
}
used[0] = true;
bool f = can(0, 1);
if(f){
std::cout << "YES" << std::endl;
}else{
std::cout << "NO" << std::endl;
}
}
tottoripaper