제출 #1002281

#제출 시각아이디문제언어결과실행 시간메모리
1002281FaisselCloud Computing (CEOI18_clo)C++17
100 / 100
316 ms1372 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n;cin >> n; vector<array<ll,3>>a(n); ll cnt = 0; for(int i=0;i<n;i++){ cin >> a[i][1] >> a[i][0] >> a[i][2]; cnt += a[i][1]; } int m;cin >> m; ll cnt2 =0; vector<array<ll,3>>b(m); for(int i=0;i<m;i++){ cin >> b[i][1] >> b[i][0] >> b[i][2]; cnt2 += b[i][1]; } sort(a.begin(),a.end(),greater<>()); sort(b.begin(),b.end(),greater<>()); ll idx = 0; vector<ll>dp(max(cnt,cnt2) + 1); for(int i=0;i<=max(cnt,cnt2);i++){ dp[i] = -1e18; } dp[0] = 0; for(int i=0;i<m;i++){ while(idx < n && b[i][0] <= a[idx][0]){ for(int j = dp.size() - 1;j >= a[idx][1];j--){ dp[j] = max(dp[j],dp[j - a[idx][1]] - a[idx][2]); } idx++; } for(int j= 0;j < dp.size() - b[i][1];j++){ dp[j] = max(dp[j],dp[j+b[i][1]] + b[i][2]); } } cout << *max_element(dp.begin(),dp.end()); }

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

clo.cpp: In function 'int main()':
clo.cpp:39:28: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   39 |             for(int j= 0;j < dp.size() - b[i][1];j++){
#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...