83942024-01-15 15:11:29Syntx29Virágos rét (50 pont)cpp17Time limit exceeded 4/50300ms4596 KiB
#include <iostream>
#include <vector>
#include <string>
using namespace std;


int main() {
	int n, k;
	cin >> n >> k;
	vector<int> be(n);
	vector<string> ki;
	for(int i = 0; i < n; i++)
	{
		cin >> be[i];
	}
	int count = 0;
	
	for (size_t i = 0; i < n-2; i++)
	{
		if (be[i] == 1)
		{
			string temp = "";
			int c2 = 0;
			for (size_t j = i + 2; j < n; j++)
			{
				if (be[j] == 1)
				{
					c2++;
					if (c2 >=k)
					{
						count += c2;
			
					}
					
				}
			}
		}
	}
	cout << count << "\n";

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/03ms1688 KiB
2Accepted0/03ms1852 KiB
3Time limit exceeded0/0300ms1732 KiB
4Wrong answer0/23ms2140 KiB
5Accepted2/23ms2396 KiB
6Accepted2/23ms2600 KiB
7Wrong answer0/33ms2688 KiB
8Wrong answer0/33ms2928 KiB
9Wrong answer0/33ms3204 KiB
10Wrong answer0/23ms3328 KiB
11Wrong answer0/33ms3380 KiB
12Wrong answer0/23ms3280 KiB
13Wrong answer0/33ms3244 KiB
14Time limit exceeded0/2300ms2812 KiB
15Time limit exceeded0/2264ms3072 KiB
16Time limit exceeded0/3261ms3132 KiB
17Time limit exceeded0/3277ms3368 KiB
18Time limit exceeded0/3277ms3280 KiB
19Wrong answer0/3100ms4596 KiB
20Time limit exceeded0/3254ms3340 KiB
21Time limit exceeded0/3266ms3524 KiB
22Time limit exceeded0/3270ms3404 KiB