Submission #86338

# Submission time Handle Problem Language Result Execution time Memory
86338 2018-11-26T07:31:59 Z NurstanDuisengaliev Telefoni (COCI17_telefoni) C++14
80 / 80
111 ms 800 KB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
vector <int> x;
int main () {
    int n, m;
    cin >> n >> m;
    bool a[n];
    for (int i = 0; i < n; i ++) {
    	cin >> a[i];
    }
    int sum = 0;
    int k = 0;
    for (int i = 0; i < n; i ++) {
        if (a[i] == 0) {
        	k ++;
        }
        else {
        	if (k != 0) {
        		x.pb(k);
        	}
        	k = 0;
        }
    }
    if (k != 0) {
    	x.pb(k);
    }
    for (int i = 0; i < x.size(); i ++) {
    	sum += x[i] /m; 
    }
    cout << sum;
    return 0;
}

Compilation message

telefoni.cpp: In function 'int main()':
telefoni.cpp:28:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < x.size(); i ++) {
                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 3 ms 516 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
6 Correct 2 ms 516 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Correct 55 ms 800 KB Output is correct
9 Correct 107 ms 800 KB Output is correct
10 Correct 111 ms 800 KB Output is correct