結果

問題 No.1708 Quality of Contest
ユーザー chocoruskchocorusk
提出日時 2021-10-15 21:32:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 1,303 bytes
コンパイル時間 3,630 ms
コンパイル使用メモリ 191,564 KB
実行使用メモリ 16,648 KB
最終ジャッジ日時 2023-10-17 20:04:17
合計ジャッジ時間 9,059 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 6 ms
4,348 KB
testcase_05 AC 6 ms
4,348 KB
testcase_06 AC 5 ms
4,348 KB
testcase_07 AC 5 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 251 ms
16,648 KB
testcase_10 AC 215 ms
11,184 KB
testcase_11 AC 242 ms
9,252 KB
testcase_12 AC 250 ms
10,268 KB
testcase_13 AC 235 ms
8,424 KB
testcase_14 AC 252 ms
10,848 KB
testcase_15 AC 260 ms
14,364 KB
testcase_16 AC 261 ms
14,028 KB
testcase_17 AC 242 ms
11,296 KB
testcase_18 AC 239 ms
11,588 KB
testcase_19 AC 243 ms
12,592 KB
testcase_20 AC 240 ms
11,112 KB
testcase_21 AC 254 ms
11,932 KB
testcase_22 AC 247 ms
10,924 KB
testcase_23 AC 257 ms
14,140 KB
testcase_24 AC 211 ms
7,000 KB
testcase_25 AC 207 ms
7,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using mint=modint998244353;

int main()
{
    int n, m; ll x;
    cin>>n>>m>>x;
    vector<vector<int>> v(m);
    for(int i=0; i<n; i++){
        int a, b;cin>>a>>b;
        b--;
        v[b].push_back(a);
    }
    vector<int> w;
    for(int i=0; i<m; i++){
        if(v[i].empty()) continue;
        sort(v[i].begin(), v[i].end(), greater<int>());
        v[i][0]+=x;
        for(auto a:v[i]){
            w.push_back(a);
        }
    }
    sort(w.begin(), w.end(), greater<int>());
    vector<ll> ws(n+1);
    for(int i=0; i<n; i++) ws[i+1]=ws[i]+w[i];
    ll ans=0;
    int k; cin>>k;
    for(int i=0; i<k; i++){
        int c; cin>>c;
        ans+=ws[c];
    }
    cout<<ans<<endl;
    return 0;
}
0