結果
| 問題 | 
                            No.2536 同値性と充足可能性
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-11-10 22:20:48 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 119 ms / 2,000 ms | 
| コード長 | 742 bytes | 
| コンパイル時間 | 4,341 ms | 
| コンパイル使用メモリ | 256,936 KB | 
| 最終ジャッジ日時 | 2025-02-17 20:59:23 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 31 | 
ソースコード
#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;
		std::vector<int> A;
		for (int i = 0; i < N; i ++) {
			if (V[i] == tt) {
				A.push_back(i + 1);
			}
		}
		for (auto a : A) {
			cout << a << (a == A.back() ? "" : " ");
		}
		cout << endl;
	}
}