結果
問題 | No.11 カードマッチ |
ユーザー |
|
提出日時 | 2024-01-13 19:40:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 700 bytes |
コンパイル時間 | 945 ms |
コンパイル使用メモリ | 87,948 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-28 01:44:14 |
合計ジャッジ時間 | 1,459 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:22:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 22 | auto [s, k] = v[i]; | ^ main.cpp:27:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 27 | for (auto [key, st] : add_m) { | ^
ソースコード
// No.11 カードマッチ #include <iostream> #include <vector> #include <map> #include <set> using namespace std; typedef long long ll; int main() { int W, H, N; cin >> W >> H >> N; vector<pair<int, int>> v; for (int i = 0; i < N; ++i) { int S, K; cin >> S >> K; --S, --K; v.emplace_back(S, K); } map<int, set<int>> add_m; map<int, set<int>> add_n; for (int i = 0; i < N; ++i) { auto [s, k] = v[i]; add_m[s].insert(k); add_n[k].insert(s); } ll res = 0; for (auto [key, st] : add_m) { res += H - st.size(); } res += (ll)(W - add_m.size()) * add_n.size(); cout << res << endl; }