Submission #1282035

#TimeUsernameProblemLanguageResultExecution timeMemory
1282035nataliaaFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) {
    int n = P.size();
    pair<int,int> p[n];
    
    for(int i = 0; i <n; i++) {
        p[i].first = P[i];
        p[i].second = i;
    }
    sort(p.begin(), p.end());
    vector<int> v;
    int s = 0;
    for(int i = 0; i < n ; i++) {
        if(p[i].first<=A) {
            A-=p[i].first;
            v.push_back(p[i].second);
            s++;
        }
        else break;
    }
    return v;
}

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:12:12: error: request for member 'begin' in 'p', which is of non-class type 'std::pair<int, int> [n]'
   12 |     sort(p.begin(), p.end());
      |            ^~~~~
festival.cpp:12:23: error: request for member 'end' in 'p', which is of non-class type 'std::pair<int, int> [n]'
   12 |     sort(p.begin(), p.end());
      |                       ^~~