結果

問題 No.2270 T0空間
ユーザー momoyuumomoyuu
提出日時 2023-04-15 10:56:00
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,330 bytes
コンパイル時間 3,805 ms
コンパイル使用メモリ 284,324 KB
実行使用メモリ 27,776 KB
最終ジャッジ日時 2024-04-19 06:33:17
合計ジャッジ時間 7,992 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 42 ms
10,752 KB
testcase_12 AC 23 ms
6,944 KB
testcase_13 AC 95 ms
15,232 KB
testcase_14 AC 96 ms
15,104 KB
testcase_15 AC 97 ms
15,232 KB
testcase_16 WA -
testcase_17 AC 305 ms
27,648 KB
testcase_18 WA -
testcase_19 AC 298 ms
27,648 KB
testcase_20 AC 308 ms
27,648 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    vector<string> s(m);
    for(int i = 0;i<m;i++) cin>>s[i];
    vector<vector<int> > cnt(1<<8,vector<int>(1<<8,0));
    vector<vector<long long> >mask(m,vector<long long>(4,0));
    for(ll i = 0;i<m;i++){
        for(ll j = 0;j<n;j++){
            if(j<64) if(s[i][j]=='1') mask[i][0] |= 1LL<<j;
            else if(j<64*2) if(s[i][j]=='1') mask[i][1] |= 1LL<<(j-64);
            else if(j<64*3) if(s[i][j]=='1') mask[i][2] |= 1LL<<(j-64*2);
            else if(s[i][j]=='1') mask[i][3] |= 1LL<<(j-64*3);
        }
    }
    ll mm = 0;
    for(ll i = 0;i<64;i++) mm |= 1 << i; 
    for(int i = 0;i<n;i++){
        vector<long long> now(4,mm);
        for(int j = 0;j<m;j++) if(s[j][i]=='1') for(int k = 0;k<4;k++) now[k] &= mask[j][k];
        for(ll j = 0;j<n;j++) if(j!=i) {
            if(j<64) if(now[0]>>j&1) cnt[i][j]++;
            else if(j<64*2) if(now[1]>>(j-64)&1) cnt[i][j]++;
            else if(j<64*3) if(now[2]>>(j-64*2)&1) cnt[i][j]++;
            else if(now[3]>>(j-64*3)&1) cnt[i][j]++;
        }
    }
    bool fn = true;
    for(int i = 0;i<n;i++) for(int j = 0;j<n;j++) if(cnt[i][j]&&cnt[j][i]) fn = false;
    cout<<(fn?"Yes\n":"No\n");

}

0