# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
761633 | vgoofficial | Cloud Computing (CEOI18_clo) | C++14 | 486 ms | 2004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Order {
ll numCores, clockRate, money;
bool operator<(Order other) {
if(other.clockRate>clockRate) {
return false;
}
return true;
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin >> n;
vector<Order> shops;
for(int i = 0; i < n; i++) {
Order temp;
cin >> temp.numCores >> temp.clockRate >> temp.money;
temp.money=-temp.money;
shops.push_back(temp);
}
cin >> m;
for(int i = 0; i < m; i++) {
Order temp;
cin >> temp.numCores >> temp.clockRate >> temp.money;
temp.numCores=-temp.numCores;
shops.push_back(temp);
}
sort(shops.begin(), shops.end());
ll maxProfit[50*(n+1)+1];
for(int j = 0; j <= 50*(n+1); j++) {
maxProfit[j]=-1e14;
}
maxProfit[0]=0;
for(int i = 1; i <= shops.size(); i++) {
ll tempMaxProfit[50*(n+1)+1];
for(int j = 0; j <= 50*(n+1); j++) {
tempMaxProfit[j]=maxProfit[j];
}
if(shops[i-1].numCores<0) {
for(int j = -shops[i-1].numCores; j <= 50*(n+1); j++) {
tempMaxProfit[j+shops[i-1].numCores]=max(tempMaxProfit[j+shops[i-1].numCores], maxProfit[j]+shops[i-1].money);
}
} else {
for(int j = 50*(n+1); j >= shops[i-1].numCores; j--) {
tempMaxProfit[j]=max(tempMaxProfit[j], maxProfit[j-shops[i-1].numCores]+shops[i-1].money);
}
}
for(int j = 0; j <= 50 * (n+1); j++) {
maxProfit[j]=tempMaxProfit[j];
}
}
ll ans = 0;
for(int i = 0; i <= 50 * (n+1); i++) {
ans=max(ans, maxProfit[i]);
}
cout << ans << endl;
}
/*
3
4 2200 700
2 1800 10
4 2000 750
3
1 1500 300
6 1900 1500
3 2400 4550
*/
컴파일 시 표준 에러 (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... |