Submission #520826

#TimeUsernameProblemLanguageResultExecution timeMemory
520826begTelefoni (COCI17_telefoni)C++17
80 / 80
38 ms860 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int cost = 0, n,tmp, d,c; main(){ cin >> n >> d; for(int i = 1; i <= n; i++){ cin >> tmp; if(tmp == 0 && i-c >=d){ cost++; c = i; } if(tmp == 1) c= i; } cout <<cost; }

Compilation message (stderr)

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