Submission #1321430

#TimeUsernameProblemLanguageResultExecution timeMemory
1321430thesentroFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) {
      ll n = P.size();
      ll c = A;

      vector<ll>v = P, h = T;
      vector<pair<ll,ll>>vp;
      for (int i=0 ; i<n ; i++)
      {
          vp.push_back({v[i], i});
      }
      sort(vp.begin(), vp.end());
      vector<ll>ans;
      for (auto i:vp)
      {
          if (c>=i.first)
          {
              c-=i.first;
              ans.push_back(i.second);
          }
      }
      return ans;
}

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:9:21: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
    9 |       vector<ll>v = P, h = T;
      |                     ^
festival.cpp:9:28: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
    9 |       vector<ll>v = P, h = T;
      |                            ^
festival.cpp:25:14: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   25 |       return ans;
      |              ^~~
      |              |
      |              vector<long long int>