結果
| 問題 | 
                            No.1900 Don't be Powers of 2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-04-08 22:46:52 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 654 bytes | 
| コンパイル時間 | 5,143 ms | 
| コンパイル使用メモリ | 166,420 KB | 
| 実行使用メモリ | 23,352 KB | 
| 最終ジャッジ日時 | 2024-11-28 13:37:42 | 
| 合計ジャッジ時間 | 7,157 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 7 WA * 35 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/maxflow>
using namespace std;
using namespace atcoder;
int main(void){
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++) cin >> A[i];
    mf_graph<int> g(n + 2);
    int s = n, t = n + 1;
    for(int i = 0; i < n; i++){
        if(__builtin_popcount(A[i]) % 2 == 0){
            g.add_edge(s, i, 1);
            for(int j = 0; j < i; j++){
                if(__builtin_popcount(A[j]) % 2 == 1){
                    g.add_edge(i, j, 1);
                }
            }
        }
        else{
            g.add_edge(i, t, 1);
        }
    }
    cout << n - g.flow(s, t) << "\n";
}