ソースコード 拡げる

Copy
```#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define chmin(x,y) x = min((x),(y));
#define chmax(x,y) x = max((x),(y));
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
const int MOD = 1000000007;
//const int MOD = 998244353;
const double PI = 3.14159265358979323846;

ll dp[(1<<20)+5];
ll ng[50];

int main(){
ll n,m;
cin >> n >> m;
vector<ll> a(m),b(m);
rep(i,m) cin >> a[i] >> b[i];
rep(i,m) --a[i],--b[i];
if(n==1){
cout << 1 << endl;
return 0;
}
rep(i,n){
ll mask = 0;
rep(j,m){
if(a[j] == i) mask += 1<<b[j];
else if(b[j] == i) mask += 1<<a[j];
}
}
rep(bit,1<<(n/2)){
bool ok = true;
rep(i,n/2){
if(bit>>i&1){
if((ng[i] & bit) > 0) ok = false;
}
}
if(ok) dp[bit] = __builtin_popcountll(bit);
else{
rep(i,n/2){
if(bit>>i&1) chmax(dp[bit],dp[bit^(1<<i)]);
}
}
}

ll ans = 0;
rep(bit,1<<((n+1)/2)){
bool ok = true;
rep(i,(n+1)/2){
if(bit>>i&1){
if((ng[n/2+i] & (bit<<(n/2))) > 0) ok = false;
}
}
if(ok){
ll mask = 0;
rep(i,(n+1)/2){
if(bit>>i&1) mask |= ng[n/2+i];
}
}
}
cout << ans << endl;
return 0;
}```

#### 提出情報

提出日時 2020-11-19 17:22:35+0900 G - Mixture Drug kapibara C++ (GCC 9.2.1) 0 1745 Byte WA 239 ms 11836 KB

#### ジャッジ結果

セット名 Sample All

 AC × 3
 AC × 22 WA × 29
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
sample_01.txt AC 6 ms 3420 KB
sample_02.txt AC 2 ms 3468 KB
sample_03.txt AC 2 ms 3428 KB
subtask_1_1.txt AC 2 ms 3420 KB
subtask_1_10.txt WA 187 ms 11792 KB
subtask_1_11.txt AC 2 ms 3552 KB
subtask_1_12.txt WA 183 ms 11604 KB
subtask_1_13.txt AC 161 ms 7576 KB
subtask_1_14.txt AC 211 ms 11776 KB
subtask_1_15.txt AC 2 ms 3468 KB
subtask_1_16.txt WA 191 ms 11672 KB
subtask_1_17.txt WA 184 ms 11672 KB
subtask_1_18.txt WA 182 ms 11812 KB
subtask_1_19.txt AC 5 ms 3440 KB
subtask_1_2.txt AC 183 ms 11792 KB
subtask_1_20.txt WA 177 ms 11792 KB
subtask_1_21.txt WA 180 ms 11676 KB
subtask_1_22.txt WA 180 ms 11620 KB
subtask_1_23.txt AC 2 ms 3480 KB
subtask_1_24.txt AC 23 ms 3988 KB
subtask_1_25.txt AC 180 ms 11788 KB
subtask_1_26.txt WA 183 ms 11720 KB
subtask_1_27.txt WA 183 ms 11676 KB
subtask_1_28.txt AC 177 ms 11604 KB
subtask_1_29.txt AC 182 ms 11672 KB
subtask_1_3.txt WA 32 ms 4636 KB
subtask_1_30.txt AC 2 ms 3596 KB
subtask_1_31.txt AC 2 ms 3484 KB
subtask_1_32.txt AC 3 ms 3584 KB
subtask_1_33.txt AC 12 ms 3896 KB
subtask_1_34.txt WA 180 ms 11664 KB
subtask_1_35.txt WA 179 ms 11772 KB
subtask_1_36.txt AC 182 ms 11676 KB
subtask_1_37.txt WA 179 ms 11804 KB
subtask_1_38.txt WA 178 ms 11728 KB
subtask_1_39.txt WA 178 ms 11836 KB
subtask_1_4.txt WA 181 ms 11612 KB
subtask_1_40.txt WA 181 ms 11624 KB
subtask_1_41.txt WA 181 ms 11760 KB
subtask_1_42.txt WA 177 ms 11724 KB
subtask_1_43.txt WA 239 ms 11812 KB
subtask_1_44.txt WA 185 ms 11808 KB
subtask_1_45.txt AC 176 ms 11808 KB
subtask_1_46.txt AC 211 ms 11720 KB
subtask_1_47.txt WA 182 ms 11724 KB
subtask_1_48.txt WA 172 ms 11664 KB
subtask_1_5.txt WA 53 ms 5644 KB
subtask_1_6.txt WA 180 ms 11676 KB
subtask_1_7.txt WA 66 ms 5648 KB
subtask_1_8.txt WA 184 ms 11796 KB
subtask_1_9.txt WA 91 ms 7676 KB