Submission #1322246

#TimeUsernameProblemLanguageResultExecution timeMemory
1322246Trisanu_DasFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> max_coupons(int A, vector<int> P, vector<int> T){
    int n; cin >> n;
    vector<int> op(n);
    iota(op.begin(), op.end(), 0);
    sort(op.begin(), op.end() [&](int i, int j){
        return T[i] * T[j] * (P[j] - P[i]) > P[j] * T[j] - P[i] * T[i];
    });
    vector<int> R;
    for(int k = 0; k < n; k++){
        int i = op[k];
        if(A > P[i]){
            R.push_back(i);
            A = T[i] * (A - P[i]);
        }else break;
    }
    return R;
}

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:9:33: error: expected primary-expression before ']' token
    9 |     sort(op.begin(), op.end() [&](int i, int j){
      |                                 ^
festival.cpp:9:35: error: expected primary-expression before 'int'
    9 |     sort(op.begin(), op.end() [&](int i, int j){
      |                                   ^~~
festival.cpp:9:42: error: expected primary-expression before 'int'
    9 |     sort(op.begin(), op.end() [&](int i, int j){
      |                                          ^~~