結果
問題 |
No.2270 T0空間
|
ユーザー |
![]() |
提出日時 | 2023-04-18 23:08:49 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 515 ms / 2,000 ms |
コード長 | 2,014 bytes |
コンパイル時間 | 3,285 ms |
コンパイル使用メモリ | 256,612 KB |
実行使用メモリ | 27,648 KB |
最終ジャッジ日時 | 2024-10-13 23:03:22 |
合計ジャッジ時間 | 8,217 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#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"); }