結果

問題 No.1708 Quality of Contest
ユーザー Nzt3Nzt3
提出日時 2022-09-28 17:18:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 753 bytes
コンパイル時間 2,214 ms
コンパイル使用メモリ 210,912 KB
実行使用メモリ 16,024 KB
最終ジャッジ日時 2023-08-24 04:29:32
合計ジャッジ時間 5,835 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 105 ms
16,024 KB
testcase_10 AC 81 ms
10,684 KB
testcase_11 AC 97 ms
8,620 KB
testcase_12 AC 102 ms
9,636 KB
testcase_13 AC 92 ms
7,760 KB
testcase_14 AC 108 ms
10,212 KB
testcase_15 AC 114 ms
13,864 KB
testcase_16 AC 113 ms
13,516 KB
testcase_17 AC 101 ms
10,724 KB
testcase_18 AC 97 ms
10,964 KB
testcase_19 AC 108 ms
12,228 KB
testcase_20 AC 100 ms
10,472 KB
testcase_21 AC 104 ms
11,444 KB
testcase_22 AC 106 ms
10,420 KB
testcase_23 AC 113 ms
13,684 KB
testcase_24 AC 79 ms
6,548 KB
testcase_25 AC 79 ms
6,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M;
  long long X;
  cin>>N>>M>>X;
  vector<vector<int>>P(M);
  for(int i=0;i<N;i++){
    int A,B;
    cin>>A>>B;
    P[B-1].push_back(A);
  }
  vector<long long>Ps;
  for(int i=0;i<M;i++){
    sort(P[i].begin(),P[i].end());
    reverse(P[i].begin(),P[i].end());
    for(int j=0;j<P[i].size();j++){
      if(j==0)Ps.push_back(P[i][j]+X);
      else Ps.push_back(P[i][j]);
    }
  }
  sort(Ps.begin(),Ps.end());
  Ps.push_back(0);
  reverse(Ps.begin(),Ps.end());
  for(int i=1;i<=N;i++){
    Ps[i]+=Ps[i-1];
  }

  int K;
  cin>>K;
  long long ans=0;
  for(int i=0;i<K;i++){
    int t;
    cin>>t;
    ans+=Ps[t];
  }
  cout<<ans<<'\n';
}
0