제출 #916968

#제출 시각아이디문제언어결과실행 시간메모리
916968ThommyDBCloud Computing (CEOI18_clo)C++17
18 / 100
367 ms3924 KiB
#include<bits/stdc++.h> using namespace std; #define int long long struct ComputersOrOrders{ int cores; int clockSpeed; int price; }; int n, m; vector<ComputersOrOrders> computers; vector<ComputersOrOrders> orders; int memo[(int)2e5+100]; int mem[(int)2e5+100]; int DP(){ memset(memo, 1, sizeof(memo)); memo[0] = 0; for(int i = 0; i < n; i++){ for(int j = 50*n; j >= computers[i].cores; j--){ memo[j] = min(memo[j], memo[j-computers[i].cores]+computers[i].price); } } for(int i = n-1; i >= 0; i--) memo[i]=min(memo[i], memo[i+1]); mem[0]=0; for(int i = 0; i < m; i++){ for(int j = 50*n; j >= orders[i].cores; j--){ mem[j] = max(mem[j], mem[j-orders[i].cores] + orders[i].price); } } int ans = 0; for(int i = 0; i <= 50*n; i++){ ans = max(ans, mem[i]-memo[i]); } return ans; } signed main(){ cin >> n; computers.resize(n); int c, f, v; for(int i = 0; i <n; i++){ cin >> computers[i].cores >> computers[i].clockSpeed >> computers[i].price; } cin >> m; orders.resize(m); for(int i = 0; i < m; i++){ cin >> orders[i].cores >> orders[i].clockSpeed >> orders[i].price; } cout << DP() << "\n"; }

컴파일 시 표준 에러 (stderr) 메시지

clo.cpp: In function 'int main()':
clo.cpp:43:9: warning: unused variable 'c' [-Wunused-variable]
   43 |     int c, f, v;
      |         ^
clo.cpp:43:12: warning: unused variable 'f' [-Wunused-variable]
   43 |     int c, f, v;
      |            ^
clo.cpp:43:15: warning: unused variable 'v' [-Wunused-variable]
   43 |     int c, f, v;
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...