Submission #791719

#TimeUsernameProblemLanguageResultExecution timeMemory
791719shoryu386Telefoni (COCI17_telefoni)C++17
80 / 80
40 ms3212 KiB
#include <bits/stdc++.h> using namespace std; #define int long long main(){ int n, d; cin >> n >> d; int cringe[n]; for (int x = 0; x < n; x++) cin >> cringe[x]; int lastOne = 0; int ans = 0; for (int x = 0; x < n; x++){ if (cringe[x] == 1) lastOne = x; if (x - lastOne >= d) ans++, lastOne = x; } cout << ans; }

Compilation message (stderr)

telefoni.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...