結果

問題 No.1479 Matrix Eraser
ユーザー jutama
提出日時 2021-04-16 21:26:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,186 bytes
コンパイル時間 3,903 ms
コンパイル使用メモリ 177,000 KB
実行使用メモリ 69,760 KB
最終ジャッジ日時 2024-07-03 00:45:35
合計ジャッジ時間 15,058 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bitset>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using namespace atcoder;

//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *//

void input() {
    
    
}


void solve() {
    
    
    int H, W; cin >> H >> W;
    set<int> As;
    map<int, bitset<500>> Ac, Ar;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            int A; cin >> A;
            As.insert(A);
            Ac[A].set(i);
            Ar[A].set(j);
        }
    }
    
    int ans = 0;
    for(auto a : As) {
        if(a == 0) continue;
        ans += min(Ac[a].count(), Ar[a].count());
    }
    cout << ans << endl;
    
    
    
    
    
}

//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *//

int main() {
    
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    std::cin.tie(0);
    ios::sync_with_stdio(false);
    
    input();
    solve();
    
    return 0;
}
0