結果

問題 No.2270 T0空間
ユーザー t98slidert98slider
提出日時 2023-04-14 22:18:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 2,149 ms
コンパイル使用メモリ 177,680 KB
実行使用メモリ 103,780 KB
最終ジャッジ日時 2024-04-18 19:47:41
合計ジャッジ時間 9,450 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 79 ms
11,152 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 209 ms
29,936 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 861 ms
103,700 KB
testcase_18 WA -
testcase_19 AC 823 ms
103,672 KB
testcase_20 AC 819 ms
103,516 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> A(m);
    vector<vector<int>> pos(2);
    for(int i = 0; i < m; i++){
        string s;
        cin >> s;
        for(int j = 0; j < n; j++){
            pos[s[j] - '0'].emplace_back(j);
        }
    }
    for(int i = 0; i < 2; i++){
        sort(pos[i].begin(), pos[i].end());
        pos[i].erase(unique(pos[i].begin(), pos[i].end()), pos[i].end());
    }
    vector<vector<bool>> B(n, vector<bool>(n));
    for(int i = 0; i < pos[0].size(); i++){
        for(int j = 0; j < pos[1].size(); j++){
            int p0 = pos[0][i], p1 = pos[1][j];
            B[p0][p1] = B[p1][p0] = true;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(!B[i][j]){
                cout << "No" << '\n';
                return 0;
            }
        }
    }
    cout << "Yes" << '\n';
}
0