Submission #1281506

#TimeUsernameProblemLanguageResultExecution timeMemory
1281506dimitri.shengelia축제 (IOI25_festival)C++20
Compilation error
0 ms0 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;

}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccdFYfZr.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccD6u3AK.o:festival.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccdFYfZr.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