結果

問題 No.1708 Quality of Contest
ユーザー bonKotsubonKotsu
提出日時 2022-07-23 12:46:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 245 ms / 2,000 ms
コード長 983 bytes
コンパイル時間 4,692 ms
コンパイル使用メモリ 263,956 KB
実行使用メモリ 16,344 KB
最終ジャッジ日時 2023-09-18 08:27:12
合計ジャッジ時間 10,974 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,116 KB
testcase_01 AC 5 ms
8,060 KB
testcase_02 AC 5 ms
8,044 KB
testcase_03 AC 7 ms
8,172 KB
testcase_04 AC 7 ms
8,216 KB
testcase_05 AC 8 ms
8,132 KB
testcase_06 AC 7 ms
8,172 KB
testcase_07 AC 6 ms
8,188 KB
testcase_08 AC 4 ms
8,044 KB
testcase_09 AC 236 ms
16,344 KB
testcase_10 AC 199 ms
10,776 KB
testcase_11 AC 225 ms
12,356 KB
testcase_12 AC 228 ms
12,672 KB
testcase_13 AC 218 ms
12,072 KB
testcase_14 AC 234 ms
12,900 KB
testcase_15 AC 245 ms
14,248 KB
testcase_16 AC 243 ms
14,036 KB
testcase_17 AC 228 ms
12,952 KB
testcase_18 AC 228 ms
13,188 KB
testcase_19 AC 230 ms
13,612 KB
testcase_20 AC 224 ms
13,096 KB
testcase_21 AC 238 ms
13,372 KB
testcase_22 AC 231 ms
12,860 KB
testcase_23 AC 243 ms
14,068 KB
testcase_24 AC 194 ms
11,204 KB
testcase_25 AC 194 ms
11,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define LP pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
template<class T>
void chmax(T& a, T b) { a = max(a, b); };
template<class T>
void chmin(T& a, T b) { a = min(a, b); };

int main() {
  int n, m; ll x;
  cin >> n >> m >> x;
  vector<int> t[200005];
  rep(i,n) {
    int a, b;
    cin >> a >> b;
    b--;
    t[b].pb(a);
  }
  vector<int> ord;
  rep(i,200005) {
    sort(rall(t[i]));
    if (t[i].size()) t[i][0] += x;
    rep(j, t[i].size()) ord.pb(t[i][j]);
  }
  sort(rall(ord));
  vector<ll> s(n+1);
  rep(i,n) s[i+1] = s[i] + ord[i];

  int k;
  cin >> k;
  ll ans = 0;
  rep(i,k) {
    int c;
    cin >> c;
    ans += s[c];
  }
  cout << ans << endl;
  return 0;
}
0