83112024-01-14 17:07:26TuruTamasVirágos rét (50 pont)cpp17Accepted 50/5019ms4164 KiB
#include <iostream>

using namespace std;
typedef long long ll;

ll N, K, V, a, r;

int main()
{
    cin >> N >> K;
    for (ll n = 0; n < N; n++) {
        cin >> a;
        V += a == 1;
    }
    for (ll i = 0; i < V-K+1; i++) {
        r += V - K - i + 1;
    }
    cout << r << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1744 KiB
2Accepted0/03ms2056 KiB
3Accepted0/019ms2196 KiB
4Accepted2/22ms2332 KiB
5Accepted2/23ms2460 KiB
6Accepted2/23ms2548 KiB
7Accepted3/33ms2796 KiB
8Accepted3/33ms2916 KiB
9Accepted3/33ms3036 KiB
10Accepted2/23ms3120 KiB
11Accepted3/33ms3116 KiB
12Accepted2/23ms3116 KiB
13Accepted3/33ms3120 KiB
14Accepted2/217ms3316 KiB
15Accepted2/218ms3524 KiB
16Accepted3/319ms3636 KiB
17Accepted3/318ms3740 KiB
18Accepted3/319ms3828 KiB
19Accepted3/318ms3832 KiB
20Accepted3/319ms3948 KiB
21Accepted3/319ms4036 KiB
22Accepted3/319ms4164 KiB