結果

問題 No.586 ダブルブッキング
ユーザー soragsorag
提出日時 2022-08-16 23:54:22
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 689 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 100,932 KB
最終ジャッジ日時 2024-04-27 04:10:59
合計ジャッジ時間 1,019 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:21:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   21 |     sort(all(c));
      |     ^~~~
      |     sqrt

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define pb push_back
#define all(x) begin(x),end(x)
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    int a,b,n,sum=0;
    cin>>a>>b>>n;
    vector<P> c(n);
    for(int i=0;i<n;i++){
        cin>>c[i].first;
    }
    sort(all(c));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(c[i].first==c[j].first) c[i].second++;
        }
        if(c[i].second>1) {
            sum+=(c[i].second-1)*(a+b);
            i+=c[i].second-1;
            
        }
        }
    cout<<sum<<endl;
    return 0;
}
  
    

0