結果

問題 No.1708 Quality of Contest
ユーザー 沙耶花沙耶花
提出日時 2021-10-15 21:34:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 264 ms / 2,000 ms
コード長 744 bytes
コンパイル時間 4,430 ms
コンパイル使用メモリ 270,056 KB
実行使用メモリ 16,388 KB
最終ジャッジ日時 2023-10-17 20:05:11
合計ジャッジ時間 10,066 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 6 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 5 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 250 ms
16,388 KB
testcase_10 AC 217 ms
12,760 KB
testcase_11 AC 252 ms
10,024 KB
testcase_12 AC 252 ms
10,896 KB
testcase_13 AC 244 ms
9,232 KB
testcase_14 AC 254 ms
11,300 KB
testcase_15 AC 264 ms
14,364 KB
testcase_16 AC 263 ms
14,052 KB
testcase_17 AC 247 ms
11,760 KB
testcase_18 AC 246 ms
12,020 KB
testcase_19 AC 249 ms
12,920 KB
testcase_20 AC 249 ms
11,592 KB
testcase_21 AC 256 ms
12,144 KB
testcase_22 AC 257 ms
11,372 KB
testcase_23 AC 262 ms
14,156 KB
testcase_24 AC 209 ms
7,852 KB
testcase_25 AC 210 ms
7,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
	 
int main(){
	
	long long N,M,X;
	cin>>N>>M>>X;
	
	vector v(M+5,vector<long long>());
	
	rep(i,N){
		long long a,b;
		cin>>a>>b;
		
		v[b].push_back(a);
	}
	vector<long long> S;
	rep(i,v.size()){
		sort(v[i].rbegin(),v[i].rend());
		if(v[i].size()>0){
			v[i][0] += X;
			rep(j,v[i].size())S.push_back(v[i][j]);
		}
	}
	
	sort(S.rbegin(),S.rend());
	
	S.insert(S.begin(),0LL);
	rep(i,S.size()-1)S[i+1] += S[i];

	long long ans = 0LL;
	int K;cin>>K;
	rep(i,K){
		int C;
		cin>>C;
		ans += S[C];
	}
	cout<<ans<<endl;
	
	return 0;
}
0