제출 #906241

#제출 시각아이디문제언어결과실행 시간메모리
906241LudisseyCloud Computing (CEOI18_clo)C++14
0 / 100
236 ms262144 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int n,m;
vector<pair<pair<int,int>,int>> table;
map<pair<int,int>,int> memo;

bool comp(pair<pair<int,int>,int> a, pair<pair<int,int>,int> b){
    if(a.first.second==b.first.second){
        if(a.second==b.second) return a.second>b.second;
        return a.first.first>b.first.first;
    }
    return a.first.second>b.first.second;
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n;
    table.resize(n);
    for (int i = 0; i < n; i++) { cin >> table[i].first.first >> table[i].first.second >> table[i].second; table[i].second=-table[i].second;}
    cin >> m;
    table.resize(n+m);
    for (int i = 0; i < m; i++) { cin >> table[i+n].first.first >> table[i+n].first.second >> table[i+n].second;  table[i+n].first.first=-table[i+n].first.first; }
    n+=m;
    sort(table.begin(),table.end(),comp);
    vector<pair<int,int>> dp1(n);
    dp1[0]={0,0};
    dp1[1]={table[0].second,table[0].first.first};
    for (int i = 1; i < n; i++)
    {
        int _n=dp1.size();
        int price=table[i].second;
        int core=table[i].first.first;
        for (int j = 0; j < _n; j++)
        {
            if(dp1[j].second+core>=0){
                dp1.push_back({dp1[j].first+price, dp1[j].second+core});
            }
        }
    }
    int mx=0;
    for (int i = 0; i < dp1.size(); i++) mx=max(dp1[i].first, mx);
    cout << mx << "\n";
    return 0;
}

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

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