結果

問題 No.2270 T0空間
ユーザー ruthenruthen
提出日時 2023-04-14 23:58:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,750 ms / 2,000 ms
コード長 966 bytes
コンパイル時間 2,937 ms
コンパイル使用メモリ 205,840 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 21:32:08
合計ジャッジ時間 11,506 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 140 ms
5,376 KB
testcase_12 AC 93 ms
5,376 KB
testcase_13 AC 412 ms
5,376 KB
testcase_14 AC 417 ms
5,376 KB
testcase_15 AC 425 ms
5,376 KB
testcase_16 AC 868 ms
5,376 KB
testcase_17 AC 1,750 ms
5,376 KB
testcase_18 AC 1,732 ms
5,376 KB
testcase_19 AC 174 ms
5,376 KB
testcase_20 AC 884 ms
5,376 KB
testcase_21 AC 167 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif

#define REP(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    V<V<int>> G(1, V<int>(N));
    iota(G[0].begin(), G[0].end(), 0);
    REP(i, M) {
        string S;
        cin >> S;
        V<V<int>> NG;
        for (auto &vec : G) {
            V<int> a0, a1;
            for (auto &i : vec) {
                if (S[i] == '0') {
                    a0.push_back(i);
                } else {
                    a1.push_back(i);
                }
            }
            if (a0.size() > 0) {
                NG.push_back(a0);
            }
            if (a1.size() > 0) {
                NG.push_back(a1);
            }
        }
        G = NG;
    }
    cout << (G.size() == N ? "Yes" : "No") << '\n';
    return 0;
}
0