Submission #167251

#TimeUsernameProblemLanguageResultExecution timeMemory
167251sansTelefoni (COCI17_telefoni)C++14
80 / 80
39 ms888 KiB
#include <cstdio> #include <numeric> #include <cmath> #include <algorithm> #include <vector> using namespace std; #define sp ' ' #define st first #define nd second #define pb push_back #define mp make_pair #define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy) #define prn(XX) cout << XX << endl #define prs(XX) cout << XX << " " typedef long long int ll; typedef unsigned long long int ull; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef pair<ll, ll> pll; typedef vector<pll> vpll; const int MOD = 1e9 + 7; const int INF = 2e9 + 13; const int mINF = -2e9 - 13; const double PI = 3.14159265358979; const double EPS = 1e-9; vector<bool> desk; int N, D; int main(int argc, char **argv){ scanf("%d %d", &N, &D); desk.resize(N); for(int i = 0; i < N; ++i){ int b; scanf("%d", &b); desk[i] = b; } int dist = 0, sol = 0; for(int i = 0; i < N; ++i){ if(desk[i]) dist = 0; else dist++; if(dist >= D and !desk[i]){ sol++; dist = 0; } } printf("%d\n", sol); return 0; } //cikisir

Compilation message (stderr)

telefoni.cpp: In function 'int main(int, char**)':
telefoni.cpp:35:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &N, &D); desk.resize(N);
     ~~~~~^~~~~~~~~~~~~~~~~
telefoni.cpp:36:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 0; i < N; ++i){ int b; scanf("%d", &b); desk[i] = b; }
                                        ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...