Submission #991946

# Submission time Handle Problem Language Result Execution time Memory
991946 2024-06-03T12:39:50 Z elesis Gym Badges (NOI22_gymbadges) C++14
0 / 100
278 ms 15964 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pii pair<int,int>
bool cmp(pii a ,pii b)
{
	return a.ff < b.ff;
}
void solve()
{
	int n;
	cin>>n;
	vector <int> x(n),l(n);
	vector <pii> a(n);
	for(int i=0;i<n;i++)
	{
		cin>>x[i];
		a[i].ff = x[i];
	}
	for(int i=0;i<n;i++)
	{
		cin>>l[i];
		a[i].ss = l[i];
	}
	sort(a.begin(),a.end());
	int cur = 0;
	int ans = n;
	for(int i=0;i<n;i++)
	{
		cur += a[i].ff;
		if(cur>l[0])
		{
			ans = i;
			break;
		}
		//cout << cur << " " << ans << "\n";
	}
	cout << ans << "\n";
}
signed main()
{
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 278 ms 15964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -