結果
| 問題 |
No.2730 Two Types Luggage
|
| コンテスト | |
| ユーザー |
june19312
|
| 提出日時 | 2024-04-19 23:54:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,352 bytes |
| コンパイル時間 | 951 ms |
| コンパイル使用メモリ | 82,200 KB |
| 最終ジャッジ日時 | 2025-02-21 05:50:46 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 7 RE * 28 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, M, W;
cin >> N >> M >> W;
vector<int> A(N), B(M), C(M);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
for (int i = 0; i < M; ++i) {
cin >> B[i];
}
for (int i = 0; i < M; ++i) {
cin >> C[i];
}
vector<pair<long long, int>> t;
for (int i = 0; i < N; ++i) {
t.push_back({static_cast<long long>(A[i]) * 1000000000000000000LL, i});
}
for (int i = 0; i < M; ++i) {
t.push_back({static_cast<long long>(C[i]) * 1000000000000000000LL / B[i], 10000000 + i});
}
sort(t.begin(), t.end());
long long ans = 0;
int weight = 0;
for (int i = t.size() - 1; i >= 0; --i) {
long long tanka = t[i].first;
int ind = t[i].second;
int omosa;
int value;
if (ind >= 10000000) {
ind -= 10000000;
omosa = B[ind];
value = C[ind];
} else {
omosa = 1;
value = A[ind];
}
if (weight + omosa <= W) {
weight += omosa;
ans += value;
} else {
if (omosa == 1) {
cout << ans << endl;
return 0;
}
}
}
cout << ans << endl;
return 0;
}
june19312