結果

問題 No.1708 Quality of Contest
ユーザー Nzt3Nzt3
提出日時 2021-10-15 22:00:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 620 bytes
コンパイル時間 1,731 ms
コンパイル使用メモリ 177,876 KB
実行使用メモリ 17,136 KB
最終ジャッジ日時 2023-10-17 20:17:46
合計ジャッジ時間 7,016 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 5 ms
4,348 KB
testcase_05 AC 6 ms
4,348 KB
testcase_06 AC 5 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 241 ms
17,136 KB
testcase_10 AC 206 ms
11,672 KB
testcase_11 AC 232 ms
9,740 KB
testcase_12 AC 236 ms
10,756 KB
testcase_13 AC 228 ms
8,912 KB
testcase_14 AC 239 ms
11,340 KB
testcase_15 AC 246 ms
14,852 KB
testcase_16 AC 247 ms
14,516 KB
testcase_17 AC 232 ms
11,784 KB
testcase_18 AC 235 ms
12,076 KB
testcase_19 AC 239 ms
13,080 KB
testcase_20 AC 237 ms
11,600 KB
testcase_21 AC 246 ms
12,420 KB
testcase_22 AC 241 ms
11,416 KB
testcase_23 AC 246 ms
14,628 KB
testcase_24 AC 197 ms
7,488 KB
testcase_25 AC 198 ms
7,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M,X;
  cin>>N>>M>>X;
  vector<vector<int>>A(M+1);
  for(int i=0,a,b;i<N;i++){
    cin>>a>>b;
    A[b].push_back(a);
  }
  int K;cin>>K;
  vector<int>C(K);
  for(int &i:C)cin>>i;
  vector<long long>all;
  for(int i=0;i<=M;i++){
    if(A[i].empty())continue;
    *max_element(A[i].begin(),A[i].end())+=X;
    for(int j:A[i])all.push_back(j);
  }
  sort(all.begin(),all.end());
  all.push_back(0);
  reverse(all.begin(),all.end());
  long long ans=0;
  for(int i=0;i<N;i++){
    all[i+1]+=all[i];
  }
  for(int i:C){
    ans+=all[i];
  }
  cout<<ans<<'\n';
}
0