| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1321423 | thesentro | 축제 (IOI25_festival) | C++20 | 0 ms | 0 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;
}
