結果

問題 No.2270 T0空間
ユーザー momoyuumomoyuu
提出日時 2023-04-18 23:08:49
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 2,014 bytes
コンパイル時間 3,433 ms
コンパイル使用メモリ 286,356 KB
実行使用メモリ 27,776 KB
最終ジャッジ日時 2024-04-22 00:31:01
合計ジャッジ時間 7,824 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 42 ms
10,880 KB
testcase_12 AC 23 ms
6,912 KB
testcase_13 AC 96 ms
15,232 KB
testcase_14 AC 97 ms
15,232 KB
testcase_15 AC 97 ms
15,232 KB
testcase_16 AC 195 ms
19,456 KB
testcase_17 AC 401 ms
27,648 KB
testcase_18 AC 403 ms
27,776 KB
testcase_19 AC 341 ms
27,520 KB
testcase_20 AC 336 ms
27,648 KB
testcase_21 AC 340 ms
27,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ull =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<ull> >mask(m,vector<ull>(5,0));
    for(ll i = 0;i<m;i++){
        for(ll j = 0;j<n;j++) if(s[i][j]=='1') {
            if(j<63) mask[i][0] |= 1LL<<j;
            else if(j<63*2) mask[i][1] |= 1LL<<(j-63);
            else if(j<63*3) mask[i][2] |= 1LL<<(j-63*2);
            else if(j<63*4) mask[i][3] |= 1LL<<(j-63*3);
            else mask[i][4] |= 1LL<<(j-63*4);
        }
    }
    ull mm = 0;
    for(ll i = 0;i<64;i++) mm |= 1LL << i; 
    for(int i = 0;i<n;i++){
        vector<ull> now(5,mm);
        int c = 0;
        vector<ull> nn(5,0);
        for(int j = 0;j<m;j++){ 
            if(s[j][i]=='1') {
                for(int k = 0;k<5;k++) now[k] &= mask[j][k];
            }else{
                for(int k = 0;k<5;k++) nn[k] |= mask[j][k];
            }
        }
        for(int k = 0;k<5;k++) now[k] = now[k] & (~nn[k]);
        //cout<<i<<" "<<now[0]<<endl;
        //cout<<i<<" "<<~nn[0]<<endl;
        for(ll j = 0;j<n;j++) if(j!=i) {
            if(j<63) {
                if((now[0]>>j)&1LL){
                cnt[i][j]++;
                //cout<<i<<" "<<j<<endl;
                }
            }else if(j<63*2) {
                if((now[1]>>(j-63))&1LL){
                    cnt[i][j]++;
                
                }//cout<<i<<" "<<j<<endl;
            }else if(j<63*3) {
                if((now[2]>>(j-63*2))&1LL) cnt[i][j]++;
            }else if(j<63*4) {
                if((now[3]>>(j-63*3))&1LL) cnt[i][j]++;
            }else if((now[4]>>(j-63*4))&1LL) cnt[i][j]++;
        }
    }
    bool fn = true;
    for(int i = 0;i<n;i++) for(int j = 0;j<n;j++) if(cnt[i][j]){
        fn = false;
        //cout<<i<<" "<<j<<endl;
    }
    cout<<(fn?"Yes\n":"No\n");
}
0