結果

問題 No.2536 同値性と充足可能性
ユーザー Carpenters-Cat
提出日時 2023-11-10 22:19:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 4,672 ms
コンパイル使用メモリ 255,940 KB
最終ジャッジ日時 2025-02-17 20:58:50
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 23
権限があれば一括ダウンロードができます

ソースコード

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