結果

問題 No.586 ダブルブッキング
ユーザー ohreitetsu
提出日時 2017-11-05 21:32:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 66,920 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 02:55:50
合計ジャッジ時間 996 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
int main(int argc, char* argv[])
{
	int P1,P2,N;
	cin>>P1;
	cin>>P2;
	cin>>N;
	int r;
	map<int,int> R;
	map<int,int>::iterator mit;
	int i;
	for (i=0;i<N;i++){
		cin>>r;
		mit=R.find(r);
		if (mit==R.end()){
			R[r]=1;
		}else{
			(*mit).second++;
		}
	}
	int aw=0;
	for (mit=R.begin();mit!=R.end();mit++){
		int num=(*mit).second;
		if (num>1){
			aw+=(num-1)*(P1+P2);
		}
	}
	cout<<aw<<endl;
	return 0;
}
0