답안 #757925

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
757925 2023-06-14T01:57:27 Z jer033 Gym Badges (NOI22_gymbadges) C++17
0 / 100
1 ms 212 KB
#include <algorithm>
#include <iostream>

long long xis[11];
long long lis[11];
long long pairs[11];
long long powstwo[11];

long long const prime=1000000007;
using namespace std;

int main()
{
	int n;
	cin >> n;
	if (n<=10)
	{
		//code the brute force
		for (int i=0; i<n; i++)
		{
			cin >> xis[i];
		}
		for (int i=0; i<n; i++)
		{
			cin >> lis[i];
			pairs[i]=prime*lis[i]+xis[i];
		}
		sort(pairs, pairs+n);
		for (int i=0; i<n; i++)
		{
			lis[i]=pairs[i]/prime;
			xis[i]=pairs[i]%prime;
			//cout << lis[i] << ' ' << xis[i] << '\n';
		}
		//what a terrible way to sort, if anyone reads this please comment on it
		for (int i=0; i<n; i++)
		{
			powstwo[i]=(1<<(n-1-i));
		}
		int x=(1<<n)-1;
		int maxbadge=0;
		for (int i=0; i<=x; i++)
		{
			int y=i;
			int level = 0;
			int badge = 0;
			for (int j=0; j<n; j++)
			{
				if (y>=powstwo[j])
				{
					y-=powstwo[j];
					if (level<=lis[j])
					{
						level+=xis[j];
						badge++;
					}
				}
			}
			maxbadge=max(badge, maxbadge);
		}
		cout << maxbadge << '\n';
	}
	else
	{
		cout << "IDK";
		//assume all lis are equal
		//do later
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -