結果
| 問題 |
No.586 ダブルブッキング
|
| コンテスト | |
| ユーザー |
Ronlynes
|
| 提出日時 | 2017-11-05 15:38:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 560 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 68,536 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 02:54:48 |
| 合計ジャッジ時間 | 994 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
ソースコード
#include <iostream>
#include <map>
using namespace std;
int main(void){
int p1, p2, n;
map<int, int> m;
cin >> p1 >> p2;
cin >> n;
for(int i=0; i<n; i++){
int r;
cin >> r;
if(m.find(r) == m.end()){
m.insert(make_pair(r, 1));
}else{
m[r]++;
}
}
int ans = 0;
for(map<int, int>::iterator ite = m.begin(); ite != m.end(); ite++){
if(ite->second >= 2){
ans += (ite->second - 1);
}
}
cout << ans * (p1 + p2) << endl;
return 0;
}
Ronlynes