結果

問題 No.1479 Matrix Eraser
ユーザー KKT89KKT89
提出日時 2021-04-16 20:05:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 843 bytes
コンパイル時間 2,768 ms
コンパイル使用メモリ 228,752 KB
実行使用メモリ 31,660 KB
最終ジャッジ日時 2023-09-15 20:12:47
合計ジャッジ時間 11,938 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 22 ms
6,852 KB
testcase_08 AC 40 ms
8,988 KB
testcase_09 AC 107 ms
14,472 KB
testcase_10 AC 249 ms
22,736 KB
testcase_11 AC 127 ms
16,196 KB
testcase_12 AC 28 ms
7,480 KB
testcase_13 AC 39 ms
9,160 KB
testcase_14 AC 29 ms
7,640 KB
testcase_15 AC 7 ms
4,376 KB
testcase_16 AC 33 ms
8,148 KB
testcase_17 AC 308 ms
25,964 KB
testcase_18 AC 308 ms
25,968 KB
testcase_19 AC 322 ms
26,092 KB
testcase_20 AC 334 ms
26,052 KB
testcase_21 AC 329 ms
25,972 KB
testcase_22 AC 344 ms
25,960 KB
testcase_23 AC 339 ms
26,088 KB
testcase_24 AC 352 ms
26,020 KB
testcase_25 AC 347 ms
26,180 KB
testcase_26 AC 341 ms
26,164 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 39 ms
7,132 KB
testcase_33 AC 39 ms
7,264 KB
testcase_34 AC 40 ms
7,284 KB
testcase_35 AC 39 ms
7,088 KB
testcase_36 AC 39 ms
7,284 KB
testcase_37 AC 20 ms
8,068 KB
testcase_38 AC 83 ms
6,504 KB
testcase_39 AC 204 ms
31,660 KB
testcase_40 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<vector<int>> a(n,vector<int>(m));
    map<int,vector<pair<int,int>>> mp;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
            mp[a[i][j]].push_back({i,j});
        }
    }
    int res=0;
    for(auto p:mp){
        if(p.first==0)continue;
        set<int>s,ss;
        for(auto pp:p.second){
            s.insert(pp.first);
            ss.insert(pp.second);
        }
        res+=min(s.size(),ss.size());
    }
    cout << res << endl;
}
0