結果
| 問題 | No.1479 Matrix Eraser |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-16 20:05:03 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 843 bytes |
| 記録 | |
| コンパイル時間 | 1,990 ms |
| コンパイル使用メモリ | 240,636 KB |
| 実行使用メモリ | 31,872 KB |
| 最終ジャッジ日時 | 2026-06-19 18:21:00 |
| 合計ジャッジ時間 | 6,602 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 WA * 10 |
ソースコード
#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;
}