結果

問題 No.1708 Quality of Contest
ユーザー icchiposticchipost
提出日時 2021-10-17 12:57:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 683 bytes
コンパイル時間 1,898 ms
コンパイル使用メモリ 177,188 KB
実行使用メモリ 16,516 KB
最終ジャッジ日時 2023-10-17 22:27:07
合計ジャッジ時間 7,604 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 6 ms
4,348 KB
testcase_04 AC 6 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,516 KB
testcase_10 AC 216 ms
11,052 KB
testcase_11 AC 243 ms
9,120 KB
testcase_12 AC 248 ms
10,136 KB
testcase_13 AC 236 ms
8,292 KB
testcase_14 AC 250 ms
10,716 KB
testcase_15 AC 263 ms
14,232 KB
testcase_16 AC 262 ms
13,896 KB
testcase_17 AC 243 ms
11,164 KB
testcase_18 AC 247 ms
11,456 KB
testcase_19 AC 247 ms
12,460 KB
testcase_20 AC 243 ms
10,980 KB
testcase_21 AC 258 ms
11,800 KB
testcase_22 AC 253 ms
10,792 KB
testcase_23 AC 263 ms
14,008 KB
testcase_24 AC 209 ms
6,868 KB
testcase_25 AC 208 ms
6,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<vector<int>> v(m);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    v[b - 1].push_back(a);
  }
  rep(i, m) {
    sort(v[i].rbegin(), v[i].rend());
    if (v[i].size()) v[i].front() += x;
  }
  vector<int> t;
  rep(i, m) for (auto a : v[i]) t.push_back(a);
  sort(t.rbegin(), t.rend());
  vector<ll> s(n + 1);
  rep(i, n) s[i + 1] += s[i] + t[i];
  int k;
  cin >> k;
  ll ans = 0;
  rep(i, k) {
    int c;
    cin >> c;
    ans += s[c];
  }
  cout << ans << endl;
  return 0;
}
0