結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー nikkukunnikkukun
提出日時 2021-07-21 21:31:54
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 962 bytes
コンパイル時間 1,540 ms
コンパイル使用メモリ 168,600 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-24 15:32:20
合計ジャッジ時間 2,964 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 8 ms
4,380 KB
testcase_06 AC 8 ms
4,380 KB
testcase_07 AC 8 ms
4,376 KB
testcase_08 AC 8 ms
4,376 KB
testcase_09 AC 8 ms
4,376 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 8 ms
4,380 KB
testcase_12 AC 8 ms
4,376 KB
testcase_13 AC 8 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pint;
typedef tuple<int, int, int> tint;

const int N = 5000 + 5;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

vector<int> a[N];

int main() {
	ios::sync_with_stdio(0);

	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int u, v;
		cin >> u >> v;
		a[u].push_back(v);
		a[v].push_back(u);
	}

	auto check = [&]() {
		for (int u = 1; u <= n; u++) {
			if (a[u].size() == 1) {
				int v = a[u][0];
				for (auto p = a[v].begin(); p != a[v].end(); p++) {
					if (*p == u) {
						a[v].erase(p);
						break;
					}
				}
				a[u].clear();
				return 1;
			}
		}
		return 0;
	};

	int cnt = 0;
	while (check()) cnt++;
	cout << ((cnt & 1) ? "Yes" : "No") << endl;

	return 0;
}
0