結果

問題 No.586 ダブルブッキング
ユーザー 0x19f0x19f
提出日時 2017-11-03 22:33:07
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 1,369 ms
コンパイル使用メモリ 164,344 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 15:58:22
合計ジャッジ時間 2,084 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll P1, P2, N, R[100];

int main(void) {
  cin >> P1 >> P2 >> N;
  REP(i, 0, N) cin >> R[i];

  map<ll, ll> mp;
  REP(i, 0, N) mp[R[i]]++;

  ll ans = 0;
  for(auto p : mp) {
    ll k = p.first;
    ll v = p.second;
    ans += (v - 1) * (P1 + P2);
  }
  cout << ans << endl;
}
0