Submission #723503

# Submission time Handle Problem Language Result Execution time Memory
723503 2023-04-14T01:56:08 Z vjudge1 Telefoni (COCI17_telefoni) C++17
32 / 80
46 ms 2472 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long
#define PB push_back
#define PF push_front

using namespace std;
signed main(){
    
   ll n,d;
   ll cont = 0;
   cin >> n >> d;
   vector<int>V;
   
   for(ll i = 0;i < n;i++){
     ll x;
     cin >> x;
     V.PB(x);
   }
   ll pos = 0;
    for(pos = 0; pos < n ;pos){
     if(V[pos] == 1){
        pos++;
        continue;
     }
     else{
 
        pos += d;
        if(pos <= n && V[pos-1] != 1)
        cont++;
    }
 }
cout << cont;
    return 0;
}

Compilation message

telefoni.cpp: In function 'int main()':
telefoni.cpp:23:27: warning: for increment expression has no effect [-Wunused-value]
   23 |     for(pos = 0; pos < n ;pos){
      |                           ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Incorrect 1 ms 212 KB Output isn't correct
8 Incorrect 46 ms 2372 KB Output isn't correct
9 Incorrect 45 ms 2472 KB Output isn't correct
10 Incorrect 41 ms 2360 KB Output isn't correct