Submission #1321423

#TimeUsernameProblemLanguageResultExecution timeMemory
1321423thesentroFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
/*
 _____ _          ____             _             
|_   _| |__   ___/ ___|  ___ _ __ | |_ _ __ ___  
  | | | '_ \ / _ \___ \ / _ \ '_ \| __| '__/ _ \ 
  | | | | | |  __/___) |  __/ | | | |_| | | (_) |
  |_| |_| |_|\___|____/ \___|_| |_|\__|_|  \___/ 
*/
 
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
ll mod = 1e9+7;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b>0)
    {
        if (b&1)
            res = (res*a)%mod;
        a = (a*a)%mod;
        b>>=1;
    }
    return res;
}
ll gcd(ll x, ll y)
{
    if (y==0)
        return x;
    return gcd(y, x%y);
}

void solve()
{
    ll n,c;
    cin>>n>>c;
    vector<ll>v(n+1), h(n+1);
    for (int i=1 ; i<=n ; i++) {cin>>v[i]; cin>>h[i];}
    vector<pair<ll,ll>>vp;
    for (int i=1 ; 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);
        }
    }
    cout<<ans.size()<<endl;
    for (auto i:ans)
        cout<<i<<" ";
    cout<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll tt = 1;
    // cin>>tt;
    while (tt--)
    {
        solve();
    }
    return 0;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccg45ywL.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cczuRk8p.o:festival.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccg45ywL.o: in function `main':
grader.cpp:(.text.startup+0x22a): undefined reference to `max_coupons(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status