Submission #1258103

#TimeUsernameProblemLanguageResultExecution timeMemory
1258103mkkkkkkkkFestival (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)
{
    vector<pair<int,int>> vec,vec2;
    for(int i=0;i<P.size();i++)
    {
        if(T[i]==2)
        {
            vec.push_back({P[i],i});
        }
        else
        vec2.push_back({P[i],i});
    }
    sort(vec.begin(),vec.end());
    sort(vec2.begin(),vec2.end());
    for(int i=0;i<vec2.size();i++)
    {
        if(A>=vec2[i].first)
        {
            a-=vec2[i].first;
            res.push_back(vec2[i].second);
        }
    }
    return res;

}

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:24:13: error: 'a' was not declared in this scope
   24 |             a-=vec2[i].first;
      |             ^
festival.cpp:25:13: error: 'res' was not declared in this scope
   25 |             res.push_back(vec2[i].second);
      |             ^~~
festival.cpp:28:12: error: 'res' was not declared in this scope
   28 |     return res;
      |            ^~~