Submission #478261

# Submission time Handle Problem Language Result Execution time Memory
478261 2021-10-06T18:31:11 Z rainboy Pismo (COCI18_pismo) C
70 / 70
15 ms 1532 KB
#include <stdio.h>

#define N	100000
#define INF	0x7fffffff

int abs_(int a) { return a > 0 ? a : -a; }
int min(int a, int b) { return a < b ? a : b; }

int main() {
	static int aa[N];
	int n, i, ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	ans = INF;
	for (i = 1; i < n; i++)
		ans = min(ans, abs_(aa[i] - aa[i - 1]));
	printf("%d\n", ans);
	return 0;
}

Compilation message

pismo.c: In function 'main':
pismo.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
pismo.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 14 ms 1488 KB Output is correct
6 Correct 15 ms 1532 KB Output is correct
7 Correct 14 ms 1520 KB Output is correct