Submission #1322255

#TimeUsernameProblemLanguageResultExecution timeMemory
1322255Trisanu_DasFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()

vector<int> max_coupons(int A, vector<int> P, vector<int> T){
    ll a = A;
    vector<ll> p(all(P)), t(all(T));
    ll n = p.size();
    vector<ll> o(n);
    iota(all(o), 0);
    sort(all(o), [&](ll i, ll j) {
        ll x = p[i], y = p[j], t1 = t[i], t2 = t[j];
        return x * t1 * t2 + y * t2 < y * t1 * t2 + x * t1;
    });
    vector<int> r;
    for(ll k = 0; k < n; k++){
        ll i = o[k];
        if(a - p[i] < 0) break;
        a -= p[i];
        a *= t[i];
        r.pb((int)i);
    }
    return r;
} 

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:23:11: error: 'class std::vector<int>' has no member named 'pb'
   23 |         r.pb((int)i);
      |           ^~