結果

問題 No.586 ダブルブッキング
ユーザー Toshihiko Yanase
提出日時 2018-04-30 22:21:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 71,204 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 23:59:40
合計ジャッジ時間 1,080 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;


int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int P1, P2, N;
  cin >> P1 >> P2 >> N;

  map<int, int> m;
  for(int i=0;i<N;i++){
    int r;
    cin >> r;
    m[r]++;
  }

  int ans = 0;
  for(auto itr = m.begin(); itr != m.end(); itr++){
    if(itr->second > 1){
      ans += (P1 + P2) * (itr->second - 1);
    }
  }
  
  cout << ans << endl;

  return 0;
}
0