結果
| 問題 | No.586 ダブルブッキング | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-11-11 20:19:43 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 369 bytes | 
| コンパイル時間 | 1,246 ms | 
| コンパイル使用メモリ | 166,680 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-24 19:27:49 | 
| 合計ジャッジ時間 | 1,662 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
	int P1, P2, P, N, tmp;
	cin >> P1 >> P2;
	P = P1 + P2;
	cin >> N;
	map<int, int> R;
	for(int i = 0; i < N; i++) {
		cin >> tmp;
		if(R.find(tmp) == R.end()) R[tmp] = 0;
		R[tmp]++;
	}
	int C = 0;
	for(auto it = R.begin(); it != R.end(); it++) {
		C += (it->second - 1) * P;
	}
	cout << C << endl;
	return 0;
}
            
            
            
        