結果

問題 No.2549 Paint Eggs
ユーザー ochiaigawaochiaigawa
提出日時 2023-11-25 13:16:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 817 bytes
コンパイル時間 2,319 ms
コンパイル使用メモリ 208,428 KB
実行使用メモリ 14,308 KB
最終ジャッジ日時 2023-11-25 13:16:18
合計ジャッジ時間 7,145 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 3 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 70 ms
12,092 KB
testcase_11 AC 54 ms
12,064 KB
testcase_12 AC 54 ms
9,472 KB
testcase_13 AC 65 ms
11,592 KB
testcase_14 AC 38 ms
9,792 KB
testcase_15 AC 6 ms
6,676 KB
testcase_16 AC 61 ms
10,988 KB
testcase_17 AC 40 ms
8,064 KB
testcase_18 AC 35 ms
7,424 KB
testcase_19 AC 49 ms
9,472 KB
testcase_20 AC 88 ms
14,308 KB
testcase_21 AC 87 ms
14,308 KB
testcase_22 AC 88 ms
14,308 KB
testcase_23 AC 89 ms
14,308 KB
testcase_24 AC 90 ms
14,308 KB
testcase_25 AC 114 ms
14,308 KB
testcase_26 AC 89 ms
14,308 KB
testcase_27 AC 87 ms
14,308 KB
testcase_28 AC 96 ms
14,308 KB
testcase_29 AC 87 ms
14,308 KB
testcase_30 AC 89 ms
14,308 KB
testcase_31 AC 87 ms
14,308 KB
testcase_32 AC 90 ms
14,308 KB
testcase_33 AC 84 ms
14,308 KB
testcase_34 AC 87 ms
14,308 KB
testcase_35 AC 86 ms
14,308 KB
testcase_36 AC 85 ms
14,308 KB
testcase_37 AC 87 ms
14,308 KB
testcase_38 AC 88 ms
14,308 KB
testcase_39 AC 84 ms
14,308 KB
testcase_40 AC 96 ms
14,308 KB
testcase_41 AC 88 ms
14,308 KB
testcase_42 AC 86 ms
14,308 KB
testcase_43 AC 86 ms
14,308 KB
testcase_44 AC 86 ms
14,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  int N, M, K;
  cin >> N >> M >> K;
  vector<int> C(N);
  vector<vector<int>> G(M);
  for(int i = 0; i < N; i++) {
    cin >> C[i];
    --C[i];
    G[C[i]].emplace_back(i);
  }
  vector<int> L(M);
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < (int) G[i].size(); j++) {
      int l = lower_bound(G[i].begin(), G[i].end(), G[i][j] + K) - G[i].begin() - j;
      L[i] = max(L[i], l);
    }
  }
  vector<int> A(M);
  for(int i = 0; i < M; i++) {
    cin >> A[i];
  }
  long long ans = 1000000000000000000;
  for(int i = 0; i < M; i++) {
    ans = min(ans, (long long) (K - L[i]) * A[i]);
  }
  cout << ans << '\n';
  return 0;
}
0