Submission #99377

# Submission time Handle Problem Language Result Execution time Memory
99377 2019-03-03T09:22:44 Z kimcoding Pismo (COCI18_pismo) C++17
70 / 70
18 ms 1280 KB
#include <cstdio>
#include <cmath>
#define min(a,b) (a<b?a:b)

int n, pre, ans = 2e9;

int main() {
	scanf("%d", &n);
	for(int i=1,now;i<=n;i++){
		scanf("%d", &now);
		if (i != 1) ans = min(ans, abs(now - pre));
		pre = now;
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message

pismo.cpp: In function 'int main()':
pismo.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
pismo.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &now);
   ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 18 ms 1152 KB Output is correct
6 Correct 17 ms 1280 KB Output is correct
7 Correct 17 ms 1272 KB Output is correct