Submission #82558

# Submission time Handle Problem Language Result Execution time Memory
82558 2018-10-31T12:41:12 Z luciocf San (COCI17_san) C++14
48 / 120
79 ms 500 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 25;

typedef long long ll;
typedef pair<int, int> pii;

pii num[maxn];

int main(void)
{
	int n;
	ll k;

	cin >> n >> k;

	for (int i = 0; i < n; i++)
		cin >> num[i].first >> num[i].second;

	int ans = 0;
	for (int mask = 1; mask < (1<<n); mask++)
	{
		int atual = 0;
		ll soma = 0LL;

		bool ok = 1;
		for (int i = 0; i < n; i++)
		{
			if (!(mask&(1<<i))) continue;

			if (num[i].first < atual) ok = 0;

			soma += (ll)num[i].second, atual = num[i].first;
		}

		if (ok && soma >= k) ans++;
	}

	cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 416 KB Output is correct
2 Correct 78 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 500 KB Output isn't correct
2 Halted 0 ms 0 KB -