結果

問題 No.2536 同値性と充足可能性
ユーザー KudeKude
提出日時 2023-11-10 21:41:57
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,612 bytes
コンパイル時間 3,635 ms
コンパイル使用メモリ 281,404 KB
実行使用メモリ 13,960 KB
最終ジャッジ日時 2023-11-10 21:42:05
合計ジャッジ時間 6,617 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic warning "-Wunused-function"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;

} int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  dsu d(2 * n);
  rep(_, m) {
    int i, j;
    string e;
    cin >> i >> e >> j;
    i--, j--;
    if (e[2] == '/') {
      d.merge(i, n + j);
      d.merge(i + n, j);
    } else {
      d.merge(i, j);
      d.merge(i + n, j + n);
    }
  }
  rep(i, n) if (d.same(i, i + n)) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  vector<char> done(n);
  VI ans;
  for (const auto& g : d.groups()) {
    if (done[g[0] % n]) continue;
    for (int x : g) done[x % n] = true;
    int c[2]{};
    for (int x : g) c[x >= n]++;
    if (c[0] > c[1]) {
      for (int x : g) if (x < n) ans.emplace_back(x);
    } else {
      for (int x : g) if (x >= n) ans.emplace_back(x - n);
    }
  }
  int sz = ans.size();
  cout << sz << '\n';
  rep(i, sz) cout << ans[i] + 1 << " \n"[i + 1 == sz];
}
0