| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1300171 | pete555 | Cloud Computing (CEOI18_clo) | C++20 | 1 ms | 580 KiB |
#include<bits/stdc++.h>
using namespace std;
#define pi pair<int,int>
#define ll long long
#define pb push_back
#define pf push_front
void fileIO(string filename) {
freopen((filename + ".in").c_str(), "r", stdin);
freopen((filename + ".out").c_str(), "w", stdout);
}
struct Transaction {
int cores;
int rate;
int price;
bool operator<(const Transaction &other) {
if(rate != other.rate) return rate > other.rate;
return price < other.price;
}
};
int main() {
cin.tie(0)->sync_with_stdio(false);
//fileIO("");
int total_cores = 0;
vector<Transaction> Transactions;
int n;
cin >> n;
for(int i = 0; i < n; i++) {
Transaction x;
cin >> x.cores >> x.rate >> x.price;
x.price = -x.price;
Transactions.pb(x);
total_cores += x.cores;
}
int m;
cin >> m;
for(int i = 0; i < m; i++) {
Transaction x;
cin >> x.cores >> x.rate >> x.price;
x.cores = -x.cores;
Transactions.pb(x);
total_cores += x.cores;
}
sort(Transactions.begin(), Transactions.end());
vector<ll> prev(total_cores + 1, LLONG_MIN);
prev[0] = 0;
for(Transaction x : Transactions) {
vector<ll> dp(prev);
for(int i = 0; i <= total_cores; i++) {
int j = i - x.cores;
if(0 <= j && j <= total_cores && prev[j] != LLONG_MIN) {
dp[i] = max(dp[i], prev[j] + x.price);
}
}
prev = dp;
}
cout << *max_element(prev.begin(), prev.end()) << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
