99172024-03-18 16:52:27CWMSzitakötő (50 pont)cpp17Wrong answer 1/5046ms6552 KiB
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <climits>

using namespace std;

int twopow(int exponent) {
	int cR = 1;
	for (size_t i = 0; i < exponent; i++)
	{
		cR = (2 * cR) % 1000000007;
	}
	return cR;
}

int main()
{
    int n, k;
	cin >> n >> k;
    k--;
	vector<int> inp(n);
	vector<int> prefix(n + 1);
	for (size_t i = 0; i < n; i++)
	{
		cin >> inp[i];
		prefix[i + 1] = prefix[i] + inp[i];
	}
	int twoPower = 0;
	for (size_t i = 0; i < n; i++)
	{
		if (2 * prefix[i] > prefix[k + 1]) {
			twoPower = i - 1;
			break;
		}
	}
	int twoPower2 = 0;
	for (size_t i = k+1; i < n+1; i++)
	{
		if (2 * prefix[i] > prefix[n]) {
			twoPower2 = n - i + 1;
		}
	}
	if (k == n - 1) twoPower++;
	cout << twopow(twoPower + twoPower2);
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base1/50
1Accepted0/03ms1680 KiB
2Wrong answer0/046ms3200 KiB
3Wrong answer0/13ms2060 KiB
4Accepted1/13ms2268 KiB
5Wrong answer0/13ms2480 KiB
6Wrong answer0/13ms2700 KiB
7Wrong answer0/12ms2780 KiB
8Wrong answer0/12ms2892 KiB
9Wrong answer0/13ms3016 KiB
10Wrong answer0/23ms3156 KiB
11Wrong answer0/23ms3368 KiB
12Wrong answer0/23ms3564 KiB
13Wrong answer0/23ms3784 KiB
14Wrong answer0/23ms3952 KiB
15Wrong answer0/23ms4064 KiB
16Wrong answer0/23ms4040 KiB
17Wrong answer0/23ms4304 KiB
18Wrong answer0/23ms4188 KiB
19Wrong answer0/23ms4188 KiB
20Wrong answer0/23ms4384 KiB
21Wrong answer0/13ms4484 KiB
22Wrong answer0/235ms5808 KiB
23Wrong answer0/237ms6088 KiB
24Wrong answer0/246ms6276 KiB
25Wrong answer0/246ms6492 KiB
26Wrong answer0/246ms6488 KiB
27Wrong answer0/219ms6388 KiB
28Wrong answer0/237ms6384 KiB
29Wrong answer0/235ms6468 KiB
30Wrong answer0/246ms6552 KiB
31Wrong answer0/243ms6468 KiB