結果

問題 No.1708 Quality of Contest
ユーザー rtyurtyu
提出日時 2021-10-18 09:41:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 70,916 KB
実行使用メモリ 6,956 KB
最終ジャッジ日時 2023-10-19 06:41:32
合計ジャッジ時間 5,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,680 KB
testcase_01 AC 3 ms
5,620 KB
testcase_02 AC 3 ms
5,680 KB
testcase_03 AC 4 ms
5,708 KB
testcase_04 AC 4 ms
5,716 KB
testcase_05 AC 4 ms
5,712 KB
testcase_06 AC 3 ms
5,704 KB
testcase_07 AC 3 ms
5,704 KB
testcase_08 AC 3 ms
5,620 KB
testcase_09 AC 88 ms
6,956 KB
testcase_10 AC 87 ms
6,956 KB
testcase_11 AC 101 ms
6,956 KB
testcase_12 AC 96 ms
6,956 KB
testcase_13 AC 93 ms
6,956 KB
testcase_14 AC 93 ms
6,956 KB
testcase_15 AC 88 ms
6,956 KB
testcase_16 AC 96 ms
6,956 KB
testcase_17 AC 95 ms
6,956 KB
testcase_18 AC 92 ms
6,956 KB
testcase_19 AC 94 ms
6,956 KB
testcase_20 AC 95 ms
6,956 KB
testcase_21 AC 92 ms
6,956 KB
testcase_22 AC 91 ms
6,956 KB
testcase_23 AC 95 ms
6,956 KB
testcase_24 AC 101 ms
6,956 KB
testcase_25 AC 98 ms
6,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

pair<int, int> p[200009];
bool vs[200009];
long long s[200009];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, x; cin >> n >> m >> x;
	for (int i = 1; i <= n; i++)
		cin >> p[i].first >> p[i].second;
	sort(p + 1, p + n + 1); reverse(p + 1, p + n + 1);
	for (int i = 1; i <= n; i++) {
		if (!vs[p[i].second]) {
			vs[p[i].second] = true;
			p[i].first += x;
		}
	}
	sort(p + 1, p + n + 1); reverse(p + 1, p + n + 1);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + p[i].first;
	long long ans = 0;
	int k; cin >> k;
	for (int i = 0; i < k; i++) {
		int a; cin >> a;
		ans += s[a];
	}
	cout << ans << '\n';
	return 0;
}
0