結果
問題 | No.11 カードマッチ |
ユーザー | kyuna |
提出日時 | 2019-08-19 08:49:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 576 bytes |
コンパイル時間 | 1,021 ms |
コンパイル使用メモリ | 76,692 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-02 08:51:07 |
合計ジャッジ時間 | 1,752 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <algorithm> #include <iostream> #include <vector> using namespace std; template <typename T> vector<T> uni(vector<T> v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); return v; } int main() { long long w, h, n; cin >> w >> h >> n; vector<int> s(n), k(n); for (int i = 0; i < n; i++) cin >> s[i] >> k[i]; long long cnt_s = uni(s).size(); long long cnt_k = uni(k).size(); long long unmatch = (w - cnt_s) * (h - cnt_k); long long match = w * h - unmatch; cout << match - n << endl; return 0; }