| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1336787 | hauserl | Cloud Computing (CEOI18_clo) | C++20 | 235 ms | 1200 KiB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
struct C{
int c;
int f;
int v;
int t; // 1 for offer, -1 for order
bool operator<(const auto& o) const {
if (f != o.f) return f > o.f;
return t > o.t;
}
};
int main() {
vector<C> computers;
int n; scanf("%d",&n);
for (int i = 0; i < n; i++) {
int c,f,v; scanf("%d %d %d",&c,&f,&v);
computers.push_back(C{c,f,v, 1});
}
int m; scanf("%d",&m);
for (int i = 0; i < m; i++) {
int c,f,v; scanf("%d %d %d",&c,&f,&v);
computers.push_back(C{c,f,v,-1});
}
sort(computers.begin(), computers.end());
int maxCores = 1e5+5;
vector<ll> dp(maxCores+1, INT_MIN);
dp[0] = 0;
for (const auto& computer : computers) {
if (computer.t == 1) {
for (int j = maxCores; j >= computer.c; j--) {
dp[j] = max(dp[j], dp[j-computer.c] - computer.v);
}
} else {
for (int j = 0; j <= maxCores-computer.c; j++) {
dp[j] = max(dp[j], dp[j+computer.c]+computer.v);
}
}
}
ll ma = 0;
for (int i = 0; i < maxCores+1; i++) {
ma = max(ma, dp[i]);
}
printf("%lld", ma);
return 0;
}컴파일 시 표준 에러 (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... | ||||
