| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 132614 | alexpetrescu | Cloud Computing (CEOI18_clo) | C++14 | 303 ms | 1400 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
#include <vector>
//FILE *fin = fopen("a.in", "r"), *fout = fopen("a.out", "w");
#define fin stdin
#define fout stdout
struct myc {
int c, f, v, t;
inline bool operator < (const myc &u) const {
if (f != u.f) return f < u.f;
else return t > u.t;
}
};
long long d[100009];
inline void _(long long &a, long long b) {
a = std::max(a, b);
}
int main() {
int calc;
fscanf(fin, "%d", &calc);
std::vector < myc > v;
for (; calc; calc--) {
int c, f, V;
fscanf(fin, "%d%d%d", &c, &f, &V);
v.push_back({c, f, V, 0});
}
int coma;
fscanf(fin, "%d", &coma);
for (; coma; coma--) {
int c, f, V;
fscanf(fin, "%d%d%d", &c, &f, &V);
v.push_back({c, f, V, 1});
}
std::sort(v.begin(), v.end());
int sumC = 0;
for (auto &x : v) {
if (x.t) {
for (int i = sumC; i >= 0; i--)
_(d[i + x.c], d[i] + x.v);
sumC += x.c;
} else {
for (int i = 1; i < x.c; i++)
_(d[0], d[i] - x.v);
for (int i = x.c; i <= sumC; i++)
_(d[i - x.c], d[i] - x.v);
}
}
fprintf(fout, "%lld\n", d[0]);
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... | ||||
