143812025-01-10 17:53:16duongtamas01Virágos rét (50 pont)cpp17Time limit exceeded 5/50300ms756 KiB
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int k;
    cin >> k;
    vector < int > t(n);

    for(int i = 0; i < n; i++){
        cin >> t[i];
    }
    int ans = 0;
    int elol = 0;
    for(int i = 0; i < n; i++){
        int cnt = 0;
        if(t[i] == 1){
            elol = i;
            for(int j = elol; j < n; j++){
                if(t[j] == 1){
                    cnt++;
                }
            }
        }

        if(cnt >= 3){
            ans += (cnt - 2);
        }
    }
    cout << ans;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base5/50
1Accepted0/01ms316 KiB
2Accepted0/01ms508 KiB
3Time limit exceeded0/0287ms756 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/31ms508 KiB
8Accepted3/31ms320 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/32ms316 KiB
12Wrong answer0/21ms316 KiB
13Wrong answer0/31ms404 KiB
14Time limit exceeded0/2300ms564 KiB
15Time limit exceeded0/2300ms564 KiB
16Time limit exceeded0/3300ms564 KiB
17Time limit exceeded0/3280ms564 KiB
18Time limit exceeded0/3289ms564 KiB
19Wrong answer0/364ms564 KiB
20Time limit exceeded0/3289ms564 KiB
21Time limit exceeded0/3284ms564 KiB
22Time limit exceeded0/3284ms564 KiB