結果

問題 No.1708 Quality of Contest
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-06-03 01:57:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 988 bytes
コンパイル時間 1,190 ms
コンパイル使用メモリ 113,436 KB
実行使用メモリ 18,692 KB
最終ジャッジ日時 2023-08-28 07:23:57
合計ジャッジ時間 8,839 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 6 ms
4,376 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 230 ms
18,692 KB
testcase_10 AC 224 ms
13,956 KB
testcase_11 AC 230 ms
11,316 KB
testcase_12 AC 237 ms
12,360 KB
testcase_13 AC 229 ms
10,368 KB
testcase_14 AC 234 ms
12,816 KB
testcase_15 AC 248 ms
16,752 KB
testcase_16 AC 246 ms
16,264 KB
testcase_17 AC 235 ms
13,332 KB
testcase_18 AC 233 ms
13,712 KB
testcase_19 AC 237 ms
14,788 KB
testcase_20 AC 233 ms
13,252 KB
testcase_21 AC 250 ms
13,876 KB
testcase_22 AC 235 ms
12,912 KB
testcase_23 AC 247 ms
16,376 KB
testcase_24 AC 214 ms
8,744 KB
testcase_25 AC 215 ms
8,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    ll N, M, X, A, B, K, ans=0;
    cin >> N >> M >> X;
    vector<priority_queue<ll>> v(M+1);
    priority_queue<ll> que;
    for (int i=0; i<N; i++){
        cin >> A >> B;
        v[B].push(A);
    }

    for (int i=1; i<=M; i++){
        bool f=1;
        while(!v[i].empty()){
            A = v[i].top();
            v[i].pop();
            if (f){
                A += X;
                f=0;
            }
            que.push(A);
        }
    }
    vector<ll> S(N+1);
    for (int i=1; i<=N; i++){
        A = que.top();
        que.pop();
        S[i] += S[i-1] + A;
    }
    cin >> K;
    for (int i=0; i<K; i++){
        cin >> A;
        ans += S[A];
    }

    cout << ans << endl;

    return 0;
}
0