제출 #751991

#제출 시각아이디문제언어결과실행 시간메모리
751991pemguimnCloud Computing (CEOI18_clo)C++14
100 / 100
707 ms5332 KiB
#include <bits/stdc++.h> #define int long long #define pii pair<int, int> #define pb push_back #define gcd __gcd #define endl "\n" #define task "hihi" using namespace std; const int N = 3e5 + 5, MOD = 1e9 + 7, INF = 1e18 + 5; int n, m, dp[N], pre[N]; vector<array<int, 3>> a; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); //freopen(task".inp", "r", stdin); //freopen(task".out", "w", stdout); cin >> n; for(int i = 1; i <= n; i++){ int x, y, z; cin >> x >> y >> z; a.pb({x, y, -z}); } cin >> m; for(int i = 1; i <= m; i++){ int x, y, z; cin >> x >> y >> z; a.pb({-x, y, z}); } sort(a.begin(), a.end(), [](array<int, 3> x, array<int, 3> y){ return (x[1] == y[1] ? x[2] < y[2] : x[1] > y[1]); }); fill(pre, pre + N, -INF); fill(dp, dp + N, -INF); pre[0] = 0; int sum = 0, ans = 0; for(int i = 0; i < a.size(); i++){ for(int j = max(0LL, a[i][0]); j <= sum + a[i][0]; j++){ if(pre[j - a[i][0]] == -INF) continue; dp[j] = max(dp[j], pre[j - a[i][0]] + a[i][2]); ans = max(ans, dp[j]); } sum = max(sum, sum + a[i][0]); for(int j = max(0LL, a[i][0]); j <= sum; j++){ pre[j] = max(dp[j], pre[j]); } } cout << ans; return 0; }

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

clo.cpp: In function 'int main()':
clo.cpp:34:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i = 0; i < a.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...