Submission #582078

#TimeUsernameProblemLanguageResultExecution timeMemory
582078talant117408Cloud Computing (CEOI18_clo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; #define pb push_back #define mp make_pair #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define lb lower_bound #define ub upper_bound #define sz(v) int((v).size()) #define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define endl '\n' struct event { ll rate, value; int cores, id; event(int _cores, ll _rate, ll _value, int _id) { cores = _cores; rate = _rate; value = _value; id = _id; } const operator <(event other) { if (rate == other.rate) return id < other.id; return rate > other.rate; } }; void solve() { int n, m; cin >> n; vector <event> tasks; int cores_available = 0; for (int i = 0; i < n; i++) { int cores; ll rate, value; cin >> cores >> rate >> value; cores_available += cores; tasks.pb(event(cores, rate, value, -1)); } cin >> m; for (int i = 0; i < m; i++) { int cores; ll rate, value; cin >> cores >> rate >> value; tasks.pb(event(cores, rate, value, i)); } vector <ll> dp(cores_available+1, -2e18); dp[0] = 0; sort(all(tasks)); for (auto X : tasks) { int cores = X.cores, id = X.id; ll value = X.value; if (id == -1) { for (int i = cores_available; i >= cores; i--) { dp[i] = max(dp[i], dp[i-cores] - value); } } else { for (int i = 0; i <= cores_available-cores; i++) { dp[i] = max(dp[i], dp[i+cores] + value); } } } cout << *max_element(all(dp)); } int main() { do_not_disturb int t = 1; //~ cin >> t; while (t--) { solve(); } return 0; }

Compilation message (stderr)

clo.cpp:28:11: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   28 |     const operator <(event other) {
      |           ^~~~~~~~