結果

問題 No.2202 贅沢てりたまチキン
ユーザー yansi819yansi819
提出日時 2024-04-11 11:42:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,107 bytes
コンパイル時間 5,520 ms
コンパイル使用メモリ 261,264 KB
実行使用メモリ 814,608 KB
最終ジャッジ日時 2024-04-11 11:42:18
合計ジャッジ時間 8,734 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using mint = modint998244353;

int main() {
  int n, m; cin >> n >> m;
  vector<vector<int>> g(2 * n);
  for (int i = 0; i < m; i++) {
    int a, b; cin >> a >> b;
    a--, b--;
    g[a].push_back(n + b);
    g[n + b].push_back(a);
    g[b].push_back(n + a);
    g[n + a].push_back(b);
  }
  vector<vector<bool>> f(2 * n, vector<bool>(2 * n, false));
  for (int i = 0; i < 2 * n; i++) {
    f[i][i] = true;
  }
  for (int i = 0; i < 2 * n; i++) {
    queue<int> que;
    que.push(i);
    while (!que.empty()) {
      int v = que.front(); que.pop();
      for (int u: g[v]) {
        if (f[i][u] == false) {
          f[i][u] = true;
          que.push(u);
        }
      }
    }
  }
  //for (int i = 0; i < 2 * n; i++) for (int j = 0; j < 2 * n; j++) cout << f[i][j] << " \n"[j == 2 * n - 1];

  bool flag = true;
  for (int i = 0; i < n; i++) {
    if (!f[i][n + i]) {
      flag = false;
      break;
    }
  }
  cout << (flag ? "Yes": "No") << endl;
  return 0;
}
0