結果
問題 | No.586 ダブルブッキング |
ユーザー |
|
提出日時 | 2020-04-08 01:13:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 741 ms |
コンパイル使用メモリ | 74,896 KB |
最終ジャッジ日時 | 2025-01-09 15:00:50 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
#include <iostream> #include <set> void solve() { int p = 0; for (int i = 0; i < 2; ++i) { int x; std::cin >> x; p += x; } int n; std::cin >> n; int ans = 0; std::set<int> ss; while (n--) { int x; std::cin >> x; if (ss.count(x)) ans += p; ss.insert(x); } std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }