제출 #1006330

#제출 시각아이디문제언어결과실행 시간메모리
1006330christinelynnCloud Computing (CEOI18_clo)C++17
18 / 100
453 ms1368 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define fi first #define se second #define pb push_back #define pii pair<int,int> #define piii pair<pair<int,int>,pair<int,int>> #define pip pair<int,pair<int,int>> int dp[100005]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; vector<piii>v; for(int i = 1; i <= n; i++){ int c,f,h; cin >> c >> f >> h; v.pb({{f,1},{c,h}}); } int m; cin >> m; for(int i = 1; i <= m; i++){ int c,f,h; cin >> c >> f >> h; v.pb({{f,-1},{c,h}}); } for(int i = 1; i <= 100000; i++){ dp[i] = -1e18; } sort(v.begin(), v.end(), greater<piii>()); for(int i = 0; i < v.size(); i++){ //cout << "here1 >> " << i << endl; if(v[i].fi.se == 1){ for(int j = 100000; j >= 1; j--){ if(j - v[i].se.fi < 0 || dp[j - v[i].se.fi] == -1e18)continue; else{ dp[j] = max(dp[j], dp[j - v[i].se.fi] - v[i].se.se); } } } else{ for(int j = 1; j <= 100000; j++){ if(j + v[i].se.fi > 100000 || dp[j + v[i].se.fi] == -1e18)continue; else{ dp[j] = max(dp[j], dp[j + v[i].se.fi] + v[i].se.se); } } } // for(int i = 1; i <= 10; i++){ // cout << "here >> " << dp[i] << endl; // } } int ans = 0; for(int i = 1; i <= 100000; i++){ ans = max(ans, dp[i]); } cout << ans << endl; }

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

clo.cpp: In function 'int main()':
clo.cpp:31:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
#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...