結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,940 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 WA -
testcase_11 AC 40 ms
10,880 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 99 ms
15,232 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 367 ms
27,648 KB
testcase_18 WA -
testcase_19 AC 345 ms
27,648 KB
testcase_20 AC 343 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 |= 1LL << i; 
    for(int i = 0;i<n;i++){
        vector<long long> now(4,mm);
        vector<long long> nn(4,mm);
        int c1 = 0,c2 = 0;
        for(int j = 0;j<m;j++){ 
            if(s[j][i]=='1') {
                c1++;
                for(int k = 0;k<4;k++) now[k] &= mask[j][k];
            }
            else{
                c2++;
                for(int k = 0;k<4;k++) nn[k] &= mask[j][k];
            }
        }
        if(c1==0) for(int k = 0;k<4;k++) now[k] = 0;
        if(c2==0) for(int k = 0;k<4;k++) nn[k] = 0;
        for(ll j = 0;j<n;j++) if(j!=i) {
            if(j<64) if((nn[0]>>j&1)&&(now[0]>>j)&1) cnt[i][j]++;
            else if(j<64*2) if((nn[1]>>(j-64)&1)&&(now[1]>>(j-64))&1) cnt[i][j]++;
            else if(j<64*3) if((nn[2]>>(j-64*2)&1)&&(now[2]>>(j-64*2))&1) cnt[i][j]++;
            else if((nn[3]>>(j-64*3)&1)&&(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