Submission #403935

#TimeUsernameProblemLanguageResultExecution timeMemory
403935RyednapRabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms204 KiB
#include "bits/stdc++.h"

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	int answer = 0;
	long long prev = 0;

	for(int i = 1; i <= n; ++i) {
		long long x; scanf("%lld", &x);
		if(x > prev + m) x = prev + m, ++answer;
		else prev = x + m;
	}
	printf("%d\n", answer);
	return 0;
}

Compilation message (stderr)

triusis.cpp: In function 'int main()':
triusis.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  scanf("%d %d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~
triusis.cpp:10:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   long long x; scanf("%lld", &x);
      |                ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...