Submission #1251292

#TimeUsernameProblemLanguageResultExecution timeMemory
1251292mychecksedadFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h"
#include "bits/stdc++.h"
#define ll long long
#define pb push_back
using namespace std;

const ll inf = 1e16;

bool comp(array<ll, 3> a1, array<ll, 3> a2){
  return (a2[0] * a2[1] * (a1[1] - 1) + a1[0] * a1[1] * (1 - a2[1]) > 0);
}

vector<int> max_coupons(int A, vector<int> P, vector<int> T){
  int n = P.size();
  vector<array<ll, 3> > a(n);
  for(int i = 0; i < n; i++){
    a[i] = {P[i], T[i], i};
  }
  sort(a.begin(), a.end(), comp);
  /*
  cout<<"sorted order: "<<endl;
  for(auto itr: a){
    cout<<itr.first<<" "<<itr.second<<endl;
  }*/
  //cout<<"compare: "<<comp({4, 1}, {8, 3})<<endl;
  /*
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
       cout<<"compare : "<<a[i].first<<" "<<a[i].second<<" : "<<a[j].first<<" "<<a[j].second<<" -> "<<comp(a[i], a[j])<<endl;
    }
  }*/

  vector<int> ans, vis(n);
  ll now = A;
    for(int i = 0; i < n; i++) ans.pb(a[ind][2]);
  

  return ans;
}
/*
4 13
4 1
500 3
8 3
14 4
*/

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:35:41: error: 'ind' was not declared in this scope; did you mean 'int'?
   35 |     for(int i = 0; i < n; i++) ans.pb(a[ind][2]);
      |                                         ^~~
      |                                         int