Submission #1093122

#TimeUsernameProblemLanguageResultExecution timeMemory
1093122InvMODCloud Computing (CEOI18_clo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const int N = 2e3+1; const ll INF = 1e18; int n, m; int c[N], C[N], F[N], f[N]; ll V[N],v[N]; namespace Sub4{ void ckSub() { int cnt = 0; for(int i = 1; i <= n; i++) cnt += (f[i] == 1); for(int i = 1; i <= m; i++) cnt += (F[i] == 1); } vector<ll> f, g; void solve() { int sum_room = 0; for(int i = 1; i <= n; i++){ sum_room = sum_room + c[i]; } f.assign(sum_room+1, INF); sum_room = 0; for(int i = 1; i <= m; i++){ sum_room = sum_room + C[i]; } g.assign(sum_room+1, -INF); f[0] = 0; for(int i = 1; i <= n; i++){ for(int j = (int)f.size()-1; i >= c[i]; i--){ f[j] = min(f[j], f[j-c[i]] + v[i]); } } g[0] = 0; for(int i = 1; i <= m; i++){ for(int j = (int)g.size()-1; j >= C[i]; j--){ g[j] = max(g[j], g[j-C[i]] + V[i]); } } for(int i = (int)f.size()-2; i >= 0; i--){ f[i] = min(f[i], f[i+1]); } ll answer = 0; for(int i = 1; i < g.size(); i++){ answer = max(answer, (g[i] - f[i])); } cout << answer <<"\n"; return; } } void inp() { cin >> n; for(int i = 1; i <= n; i++){ cin >> c[i] >> f[i] >> v[i]; } cin >> m; for(int i = 1; i <= m; i++){ cin >> C[i] >> F[i] >> V[i]; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); inp(); if(Sub4::ckSub()){ Sub4::solve(); } return 0; }

Compilation message (stderr)

clo.cpp: In function 'void Sub4::solve()':
clo.cpp:56:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         for(int i = 1; i < g.size(); i++){
      |                        ~~^~~~~~~~~~
clo.cpp: In function 'int main()':
clo.cpp:83:19: error: could not convert 'Sub4::ckSub()' from 'void' to 'bool'
   83 |     if(Sub4::ckSub()){
      |        ~~~~~~~~~~~^~
      |                   |
      |                   void