Submission #75047

# Submission time Handle Problem Language Result Execution time Memory
75047 2018-09-08T06:43:05 Z charlies_moo Telefoni (COCI17_telefoni) C++17
0 / 80
58 ms 2116 KB
#include <iostream>

using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    int lt;
    int c = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a == 1) {
            lt = a;
        } else if (i - lt == d) {
            lt = i;
            c++;
        }
    }

    cout << c << endl;

    return 0;
}

Compilation message

telefoni.cpp: In function 'int main()':
telefoni.cpp:15:22: warning: 'lt' may be used uninitialized in this function [-Wmaybe-uninitialized]
         } else if (i - lt == d) {
                    ~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 508 KB Output isn't correct
3 Incorrect 2 ms 508 KB Output isn't correct
4 Incorrect 2 ms 508 KB Output isn't correct
5 Incorrect 2 ms 508 KB Output isn't correct
6 Incorrect 2 ms 508 KB Output isn't correct
7 Incorrect 2 ms 540 KB Output isn't correct
8 Incorrect 58 ms 1064 KB Output isn't correct
9 Incorrect 57 ms 1468 KB Output isn't correct
10 Incorrect 56 ms 2116 KB Output isn't correct