結果
| 問題 |
No.2549 Paint Eggs
|
| コンテスト | |
| ユーザー |
hatsuka_iwa
|
| 提出日時 | 2023-11-25 15:15:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 2,000 ms |
| コード長 | 663 bytes |
| コンパイル時間 | 1,579 ms |
| コンパイル使用メモリ | 171,244 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-26 10:51:04 |
| 合計ジャッジ時間 | 7,956 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 45 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, K; cin >> N >> M >> K;
long long Ans = 1e18;
vector<int> C(N), A(M), Count(M), MaxColor(M);
for (int &B : C) {
cin >> B;
B--;
}
for (int &B : A) cin >> B;
for (int i = 0; i < K; i++) {
Count.at(C.at(i))++;
MaxColor.at(C.at(i)) = max(MaxColor.at(C.at(i)), Count.at(C.at(i)));
}
for (int i = K; i < N; i++) {
Count.at(C.at(i - K))--;
Count.at(C.at(i))++;
MaxColor.at(C.at(i)) = max(MaxColor.at(C.at(i)), Count.at(C.at(i)));
}
for (int i = 0; i < M; i++)
Ans = min(Ans, (long long)(K - MaxColor.at(i)) * A.at(i));
cout << Ans << endl;
}
hatsuka_iwa