結果

問題 No.1479 Matrix Eraser
ユーザー だれだれ
提出日時 2021-04-16 20:59:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,851 bytes
コンパイル時間 3,438 ms
コンパイル使用メモリ 188,744 KB
実行使用メモリ 73,740 KB
最終ジャッジ日時 2023-09-15 22:24:43
合計ジャッジ時間 10,005 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
49,872 KB
testcase_01 AC 22 ms
50,068 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 43 ms
52,512 KB
testcase_08 AC 60 ms
54,676 KB
testcase_09 AC 110 ms
59,952 KB
testcase_10 AC 204 ms
69,252 KB
testcase_11 AC 128 ms
62,016 KB
testcase_12 AC 48 ms
53,492 KB
testcase_13 AC 58 ms
54,716 KB
testcase_14 AC 51 ms
53,852 KB
testcase_15 AC 27 ms
50,712 KB
testcase_16 AC 54 ms
54,100 KB
testcase_17 AC 249 ms
73,172 KB
testcase_18 AC 249 ms
73,368 KB
testcase_19 AC 250 ms
73,368 KB
testcase_20 AC 251 ms
73,448 KB
testcase_21 AC 249 ms
73,372 KB
testcase_22 AC 251 ms
73,412 KB
testcase_23 AC 243 ms
73,740 KB
testcase_24 AC 250 ms
73,372 KB
testcase_25 AC 251 ms
73,500 KB
testcase_26 AC 242 ms
73,420 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 76 ms
50,136 KB
testcase_33 AC 75 ms
50,192 KB
testcase_34 AC 76 ms
49,876 KB
testcase_35 AC 76 ms
50,068 KB
testcase_36 AC 76 ms
49,992 KB
testcase_37 AC 71 ms
49,940 KB
testcase_38 AC 237 ms
73,692 KB
testcase_39 AC 180 ms
73,412 KB
testcase_40 AC 22 ms
50,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <unordered_set>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using i64 = long long;
template<class T, class U>
bool chmin(T& a, const U& b) { return (b < a) ? (a = b, true) : false; }
template<class T, class U>
bool chmax(T& a, const U& b) { return (b > a) ? (a = b, true) : false; }

template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(vector<T>&v){stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v){if(v.size())o<<join(v);return o;}
template<typename T>string join(vector<vector<T>>&vv){string s="\n";rep(i,vv.size())s+=join(vv[i])+"\n";return s;}
template<typename T>ostream& operator<<(ostream&o,vector<vector<T>>&vv){if(vv.size())o<<join(vv);return o;}

int main()
{
    int h, w;
    cin >> h >> w;
    vector<set<int>> tate(500001), yoko(500001);
    rep(i, h)
    {
        vector<int> a(w);
        cin >> a;
        rep(j, w)
        {
            tate[a[j]].insert(j);
            yoko[a[j]].insert(i);
        }
    }
    int ans = 0;
    rep(i, 1, 500001) ans += min(tate[i].size(), yoko[i].size());
    cout << min(ans, 250000) << endl;
}
0