結果

問題 No.2536 同値性と充足可能性
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-11-10 22:19:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 4,287 ms
コンパイル使用メモリ 267,628 KB
実行使用メモリ 14,980 KB
最終ジャッジ日時 2023-11-10 22:19:44
合計ジャッジ時間 8,953 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,676 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,676 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 8 ms
6,676 KB
testcase_21 AC 10 ms
6,676 KB
testcase_22 AC 9 ms
6,676 KB
testcase_23 AC 83 ms
11,128 KB
testcase_24 AC 86 ms
10,104 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
int main () {
	int N, M;
	cin >> N >> M;
	two_sat T(N);
	while (M--) {
		int a, b;
		string s;
		cin >> a >> s >> b;
		a --; b --;
		bool x = s == "<==>";
		T.add_clause(a, true, b, !x);
		T.add_clause(a, false, b, x);
	}
	bool ok = T.satisfiable();
	if (!ok) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
		auto V = T.answer();
		int s = 0;
		for (auto b : V) {
			s += b;
		}
		bool tt = s * 2 >= N;
		cout << max(s, N - s) << endl;
		for (int i = 0; i < N; i ++) {
			if (V[i] == tt) {
				cout << i + 1 << " ";
			}
		}
		cout << endl;
	}
}
0