結果

問題 No.2549 Paint Eggs
ユーザー tonphytonphy
提出日時 2023-11-25 13:30:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 719 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 69,644 KB
実行使用メモリ 8,092 KB
最終ジャッジ日時 2023-11-25 13:30:21
合計ジャッジ時間 7,407 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,548 KB
testcase_01 AC 3 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 3 ms
6,548 KB
testcase_04 AC 3 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 3 ms
6,548 KB
testcase_07 AC 3 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 3 ms
6,548 KB
testcase_10 AC 115 ms
7,324 KB
testcase_11 AC 106 ms
8,092 KB
testcase_12 AC 86 ms
6,812 KB
testcase_13 AC 108 ms
7,324 KB
testcase_14 AC 79 ms
7,220 KB
testcase_15 AC 9 ms
6,548 KB
testcase_16 AC 102 ms
7,068 KB
testcase_17 AC 70 ms
6,684 KB
testcase_18 AC 61 ms
6,556 KB
testcase_19 AC 82 ms
6,940 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;

int main(){
  int n,m,k;
  ll color[200005];
  ll cost[200005];
  ll cnt[200005];

  cin>>n>>m>>k;
  for(int i=1;i<=n;i++){
    cin>>color[i];
  }
  for(int i=1;i<=m;i++){
    cin>>cost[i];
  }

  ll minimum=LLONG_MAX;
  for(int i=1;i<=k;i++){
    cnt[color[i]]++;
  }
  for(int i=1;i<=m;i++){
    minimum=min(minimum,cost[i]*(k-cnt[i]));
  }
  for(int i=1;i<=n-k;i++){
    int left=color[i];
    int right=color[i+k];
    cnt[left]--;
    cnt[right]++;
    minimum=min(minimum,cost[left]*(k-cnt[left]));
    minimum=min(minimum,cost[right]*(k-cnt[right]));
  }
  cout<<minimum<<endl;
  return(0);
}
0