Submission #971840

# Submission time Handle Problem Language Result Execution time Memory
971840 2024-04-29T11:26:59 Z Sunbae Stove (JOI18_stove) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

signed main(){
	int n, k; scanf("%d %d", &n, &k);
	int mx = INT_MIN, mn = INT_MAX;
	for(int i = 0, x; i<n; ++i){
		scanf("%d", &x); mx = max(mx, x); mn = min(mn, x);
	}
	printf("%d", mx - mn - k + 1);
}

Compilation message

stove.cpp: In function 'int main()':
stove.cpp:5:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  int n, k; scanf("%d %d", &n, &k);
      |            ~~~~~^~~~~~~~~~~~~~~~~
stove.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   scanf("%d", &x); mx = max(mx, x); mn = min(mn, x);
      |   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -