結果
問題 |
No.11 カードマッチ
|
ユーザー |
👑 |
提出日時 | 2020-02-29 23:49:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 965 bytes |
コンパイル時間 | 778 ms |
コンパイル使用メモリ | 89,276 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 20:22:22 |
合計ジャッジ時間 | 1,449 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <iostream> #include <map> #include <set> #include <vector> #include <algorithm> using namespace std; int main(){ long long h,w,n;cin>>h>>w>>n; map<long long,long long> M; map<long long,long long> V; set<long long> Ms; set<long long> Vs; vector<pair<long long,long long> > A(n); for(int i = 0; n > i; i++){ long long a,b;cin>>a>>b; M[a]++; V[b]++; Ms.insert(a); Vs.insert(b); A[i].first = a; A[i].second = b; } long long ans = 0; for(auto x: M){ ans += w-x.second; } for(auto x: V){ ans += h-x.second; } for(auto x: Ms){ for(auto y: Vs){ bool t = true; for(int i = 0; n > i; i++){ if(x == A[i].first && y == A[i].second){ t = false; break; } } ans -= t; } } cout << ans << endl; }