結果
| 問題 | No.408 五輪ピック |
| コンテスト | |
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-08-07 06:10:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,106 bytes |
| コンパイル時間 | 786 ms |
| コンパイル使用メモリ | 64,476 KB |
| 実行使用メモリ | 191,744 KB |
| 最終ジャッジ日時 | 2024-11-07 04:38:19 |
| 合計ジャッジ時間 | 3,864 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 6 MLE * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | int a, b; scanf("%d %d", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int n, m;
vector<int> g[20001];
vector<int> h[20001];
int memo[20001][20001];
int main(void){
cin >> n >> m;
rep(i, m){
int a, b; scanf("%d %d", &a, &b);
a--; b--;
g[a].push_back(b);
g[b].push_back(a);
memo[a][b] = true;
}
//1 - u - vとなるような辺を見つける
for(int u : g[0]){
for (int v : g[u]){
//頂点に戻るようなものは入れない
if(v != 0) h[u].push_back(v);
}
}
for (int i = 1; i < n; ++i){
for (int j = i + 1; j < n; ++j){
if(h[i].size() > 3 && h[j].size() > 3){
printf("YES\n"); return 0;
}
for (int p : h[i]){
for (int q : h[j]){
if(p != j && p != q && i != q){
printf("YES\n"); return 0;
}
}
}
}
}
printf("NO\n");
return 0;
}
srup٩(๑`н´๑)۶