Submission #1344628

#TimeUsernameProblemLanguageResultExecution timeMemory
1344628KasymKFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
// #include "grader.cpp"
#include "festival.h"
using namespace std;
#define ff first
#define ss second    
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
#define mm make_pair
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 2e5+5;
ll par[N];
int sz;

int f(ll m){
    int l=1, r=sz, id=0;
    while(l<=r){
        int mid=(l+r)>>1;
        if(par[mid]<=m)
            l=mid+1, id=mid;
        else
            r=mid-1;
    }
    return id;
}

vector<int> max_coupons(int m, vector<int> p, vector<int> t){
    int n=(int)t.size();
    vector<vector<pii>> v(2);
    for(int i = 1; i <= n; ++i)
        v[t[i-1]-1].pb({p[i-1], i-1});
    for(int ad = 0; ad < 2; ++ad)
        sort(all(v[ad]));
    sz=(int)v[0].size();
    for(int i = 1; i <= sz; ++i)
        par[i]=par[i-1]+v[0][i-1].ff;
    int answer=f(m), id=0;
    vector<int> ans;
    ll M=m;
    for(int i = 0; i < (int)v[1].size(); ++i){
        if(M<v[1][i].ff)
            break;
        M=(M-v[1][i].ff)*2ll;
        umin(M, 1e9*1ll*n);
        if(umax(answer, f(M)+i+1))
            id=i+1;
    }
    for(int i = 0; i < id; ++i)
        ans.pb(v[1][i].ss);
    for(int i = 0; i < answer-id; ++i)
        ans.pb(v[0][i].ss);
    return ans;
}

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:51:13: error: no matching function for call to 'umin(long long int&, double)'
   51 |         umin(M, 1e9*1ll*n);
      |         ~~~~^~~~~~~~~~~~~~
festival.cpp:16:23: note: candidate: 'template<class T> bool umin(T&, T)'
   16 | template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
      |                       ^~~~
festival.cpp:16:23: note:   template argument deduction/substitution failed:
festival.cpp:51:13: note:   deduced conflicting types for parameter 'T' ('long long int' and 'double')
   51 |         umin(M, 1e9*1ll*n);
      |         ~~~~^~~~~~~~~~~~~~