結果

問題 No.2270 T0空間
ユーザー t98slider
提出日時 2023-04-14 22:18:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 181,680 KB
実行使用メモリ 103,660 KB
最終ジャッジ日時 2024-10-10 13:10:13
合計ジャッジ時間 8,226 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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