제출 #947157

#제출 시각아이디문제언어결과실행 시간메모리
947157NextBasiliskCloud Computing (CEOI18_clo)C++14
0 / 100
25 ms608 KiB
#include <bits/stdc++.h> #include <iostream> #define ll long long #define pb push_back #define F first #define S second using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; vector<pair<pair<ll,ll>, pair<ll,ll> > > action; for(ll i = 0; i < n; i++){ ll c, f, v; cin >> c >> f >> v; action.pb({{f, 1}, {v, c}}); } ll m; cin >> m; for(ll i = 0; i < m; i++){ ll c, f, v; cin >> c >> f >> v; action.pb({{f, 0}, {v, c}}); } sort(action.begin(), action.end()); vector<ll> ans(50 * n + 100, -1e9); ans[0] = 0; while(!action.empty()){ ll curC = action[action.size() - 1].S.S; ll curV = action[action.size() - 1].S.F; ll curT = action[action.size() - 1].F.S; if(curT == 1){ for(ll i = 50 * n - curC; i >= 0; i--){ if(ans[i + curC] > ans[i] - curV){ ans[i + curC] = ans[i] - curV; } } } else{ for(ll i = curC; i <= 50 * n; i++){ if(ans[i - curC] > ans[i] + curV){ ans[i - curC] = ans[i] + curV; } } } action.pop_back(); } ll ansG = 0; for(int i = 0; i < ans.size(); i++){ ansG = max(ansG, ans[i]); } cout << ansG << endl; }

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

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