結果
問題 | No.586 ダブルブッキング |
ユーザー |
|
提出日時 | 2018-05-13 00:12:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 368 bytes |
コンパイル時間 | 1,346 ms |
コンパイル使用メモリ | 163,904 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 09:46:22 |
合計ジャッジ時間 | 1,892 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int p1,p2,N, num, ans=0; vector<int> r; cin >> p1; cin >> p2; cin >> N; while(cin >> num) r.push_back(num); sort(r.begin(),r.end()); int pre=0; for(int i=0;i<N;i++){ if(pre==r[i]) ans+=p1+p2; else pre=r[i]; } cout << ans << endl; return 0; }