結果

問題 No.1708 Quality of Contest
ユーザー publflpublfl
提出日時 2021-10-15 21:47:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 56,132 KB
実行使用メモリ 16,188 KB
最終ジャッジ日時 2023-10-17 20:12:27
合計ジャッジ時間 4,027 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,772 KB
testcase_01 AC 4 ms
8,772 KB
testcase_02 AC 4 ms
8,776 KB
testcase_03 AC 6 ms
8,900 KB
testcase_04 AC 6 ms
8,936 KB
testcase_05 AC 6 ms
8,884 KB
testcase_06 AC 5 ms
8,872 KB
testcase_07 AC 5 ms
8,880 KB
testcase_08 AC 4 ms
8,724 KB
testcase_09 AC 113 ms
16,188 KB
testcase_10 AC 94 ms
10,728 KB
testcase_11 AC 115 ms
12,124 KB
testcase_12 AC 122 ms
12,484 KB
testcase_13 AC 109 ms
11,828 KB
testcase_14 AC 122 ms
12,728 KB
testcase_15 AC 137 ms
13,904 KB
testcase_16 AC 132 ms
13,808 KB
testcase_17 AC 115 ms
12,844 KB
testcase_18 AC 119 ms
12,964 KB
testcase_19 AC 123 ms
13,384 KB
testcase_20 AC 116 ms
12,768 KB
testcase_21 AC 125 ms
13,148 KB
testcase_22 AC 117 ms
12,756 KB
testcase_23 AC 130 ms
13,840 KB
testcase_24 AC 94 ms
11,152 KB
testcase_25 AC 95 ms
11,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <vector>
#include <algorithm>

std::vector<int> V[200010],save;
long long int sum[200010];
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	
	for(int i=1;i<=a;i++)
	{
		int d,e;
		scanf("%d%d",&d,&e);
		V[e].push_back(d);
	}
	
	for(int i=1;i<=b;i++) std::sort(V[i].begin(),V[i].end());
	
	for(int i=1;i<=b;i++)
	{
		if(V[i].size()>=1)
		{
			std::reverse(V[i].begin(),V[i].end());
			save.push_back(V[i][0]+c);
			for(int j=1;j<V[i].size();j++) save.push_back(V[i][j]);
		}
	}
	
	std::sort(save.begin(),save.end());
	std::reverse(save.begin(),save.end());
	
	for(int i=0;i<save.size();i++) sum[i+1] = sum[i] + save[i];
	
	int d;
	scanf("%d",&d);
	long long int ans = 0;
	for(int i=1;i<=d;i++)
	{
		int e;
		scanf("%d",&e);
		ans += sum[e];
	}
	printf("%lld",ans);
}
0