結果
| 問題 | No.408 五輪ピック |
| コンテスト | |
| ユーザー |
eitaho
|
| 提出日時 | 2016-08-07 23:39:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,733 bytes |
| 記録 | |
| コンパイル時間 | 1,009 ms |
| コンパイル使用メモリ | 90,228 KB |
| 実行使用メモリ | 250,972 KB |
| 最終ジャッジ日時 | 2024-11-07 09:59:58 |
| 合計ジャッジ時間 | 6,912 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 1 MLE * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:57:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
57 | scanf("%d %d", &N, &M);
| ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:60:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
60 | scanf("%d %d", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <climits>
#include <numeric>
#include <functional>
#include <time.h>
#include <bitset>
#include <emmintrin.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)a; i <= (int)b; i++)
template<class T> void checkmin(T &a, T b) { if (b < a) a = b; }
template<class T> void checkmax(T &a, T b) { if (b > a) a = b; }
const int MaxN = 20000;
const int MaxM = 50000;
int N, M;
bool Adj[MaxN][MaxN];
vector<Pii> E;
void solve() {
rep(ea, E.size()) {
int a = E[ea].first, b = E[ea].second;
if (!Adj[0][a] && !Adj[0][b]) continue;
ll eb = lower_bound(E.begin() + ea + 1, E.end(), Pii(a + 1, 0)) - E.begin();
for (; eb < E.size(); eb++) {
int c = E[eb].first, d = E[eb].second;
if (Adj[0][a] && (Adj[b][c] && Adj[d][0] || Adj[b][d] && Adj[c][0]) ||
Adj[0][b] && (Adj[a][c] && Adj[d][0] || Adj[a][d] && Adj[c][0])) {
cout << "YES\n";
return;
}
}
}
cout << "NO\n";
}
int main() {
int N, M;
scanf("%d %d", &N, &M);
rep(i, M) {
int a, b;
scanf("%d %d", &a, &b);
a--; b--;
Adj[a][b] = Adj[b][a] = true;
if (a > b) swap(a, b);
if (a != 0) E.push_back(Pii(a, b));
}
sort(E.begin(), E.end());
solve();
return 0;
}
eitaho