結果
問題 | No.1708 Quality of Contest |
ユーザー | rtyu |
提出日時 | 2021-10-18 09:41:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 99 ms / 2,000 ms |
コード長 | 702 bytes |
コンパイル時間 | 861 ms |
コンパイル使用メモリ | 72,028 KB |
実行使用メモリ | 6,784 KB |
最終ジャッジ日時 | 2024-09-19 03:02:19 |
合計ジャッジ時間 | 5,179 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#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; }