Submission #78005

# Submission time Handle Problem Language Result Execution time Memory
78005 2018-10-01T17:43:15 Z Saboon Cloud Computing (CEOI18_clo) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm?

#define PB push_back

using namespace std;

typedef long long ll;

const ll INF = 1e15;
const int maxn = 1e5 + 100;

struct Event {
    int cores;
    int freq;
    int value;
    int id;

    Event(int cores_, int freq_, int value_, int id_):
        cores(cores_), freq(freq_), value(value_), id(id_) {}

    bool operator < (const Event& other) const {
        if (freq != other.freq)
            return freq > other.freq;
        return id < other.id;
    }
};

int n, m;
vector <Event> events;
vector <ll> dp;

int main() {
    int cores_available = 0;

    cin >> n;
    for (int i = 0; i < n; i++) {
        int cores, freq, price;
        cin >> cores >> freq >> price;
        cores_available += cores;
        events.push_back(Event(cores, freq, price, -1));
    }
    cin >> m;
    for (int i = 0; i < m; i++) {
        int cores, freq, reward;
        cin >> cores >> freq >> reward;
        events.PB (Event (cores, freq, reward, i));
    }

    sort (events.begin(), events.end());

    dp.resize (cores_available + 1, -INF);
    dp[0] = 0;

    for (const Event& evt : events) {
        if (evt.id == -1) {
            for (int i = cores_available; i >= evt.cores; i--)
                dp[i] = max(dp[i], dp[i - evt.cores] - evt.value);
        }
        else {
            for (int i = 0; i <= cores_available - evt.cores; i++)
                dp[i] = max(dp[i], dp[i + evt.cores] + evt.value);
        }
    }

    ll result = -1;
    for (int i = 0; i <= cores_available; i++)
        result = max (result, dp[i]);

    cout << result << "\n";

    return 0;
}

Compilation message

clo.cpp:3:21: error: missing terminating > character
 #include <algorithm?
                     ^
clo.cpp:3:10: fatal error: algorithm?: No such file or directory
 #include <algorithm?
          ^
compilation terminated.