結果

問題 No.408 五輪ピック
ユーザー pekempeypekempey
提出日時 2016-08-05 22:37:56
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 663 bytes
コンパイル時間 1,485 ms
コンパイル使用メモリ 161,528 KB
実行使用メモリ 54,016 KB
最終ジャッジ日時 2024-04-24 15:50:58
合計ジャッジ時間 4,310 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 12 ms
6,656 KB
testcase_06 AC 114 ms
5,376 KB
testcase_07 AC 14 ms
5,376 KB
testcase_08 AC 10 ms
6,656 KB
testcase_09 AC 10 ms
5,504 KB
testcase_10 AC 118 ms
5,376 KB
testcase_11 AC 113 ms
5,376 KB
testcase_12 AC 168 ms
5,376 KB
testcase_13 AC 12 ms
7,680 KB
testcase_14 AC 45 ms
5,376 KB
testcase_15 AC 11 ms
5,760 KB
testcase_16 AC 14 ms
8,960 KB
testcase_17 AC 13 ms
6,784 KB
testcase_18 AC 15 ms
5,760 KB
testcase_19 AC 16 ms
5,760 KB
testcase_20 AC 55 ms
5,376 KB
testcase_21 AC 33 ms
5,376 KB
testcase_22 AC 96 ms
5,376 KB
testcase_23 AC 49 ms
53,760 KB
testcase_24 WA -
testcase_25 AC 86 ms
5,504 KB
testcase_26 AC 238 ms
5,376 KB
testcase_27 AC 278 ms
6,016 KB
testcase_28 AC 43 ms
5,376 KB
testcase_29 AC 43 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |                 ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#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");
}
0