| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1281506 | dimitri.shengelia | Festival (IOI25_festival) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, x;
cin >> n >> x;
pair<int, int> p[n];
int t[n];
vector <int> v;
for ( int i = 0; i < n; i++ ) {
cin >> p[i].first;
p[i].second = i;
}
for ( int i = 0; i < n; i++ ) {
cin >> t[i];
}
sort ( p, p + n );
for ( int i = 0; i < n and x >= p[i].first; i++ ) {
x -= p[i].first;
v.push_back( p[i].second );
}
cout << v.size() << "\n";
for ( int i = 0; i < v.size() - 1; i++ ) {
cout << v[i] << " ";
}
if ( v.size() > 0 ) {
cout << v[v.size() - 1] << "\n";
}
return 0;
}
