結果
問題 |
No.408 五輪ピック
|
ユーザー |
|
提出日時 | 2016-08-05 22:37:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 1,559 ms |
コンパイル使用メモリ | 161,376 KB |
実行使用メモリ | 54,144 KB |
最終ジャッジ日時 | 2024-11-07 00:27:02 |
合計ジャッジ時間 | 4,556 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘bool solve()’: main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d %d", &u, &v); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> g[20202]; bitset<20202> path[20202]; // last bool solve() { cin >> n >> m; for (int i = 0; i < m; i++) { int u, v; scanf("%d %d", &u, &v); u--; v--; g[u].push_back(v); g[v].push_back(u); } for (int i : g[0]) { for (int j : g[i]) { path[j][i] = true; } } for (int i = 0; i < n; i++) { for (int j : g[i]) { if (path[i].count() == 1 && path[j].count() == 1) { if ((path[i] & path[j]).none()) return true; } else if (path[i].count() >= 1 && path[j].count() >= 1) { return true; } } } return false; } int main() { puts(solve() ? "YES" : "NO"); }