제출 #1127872

#제출 시각아이디문제언어결과실행 시간메모리
1127872sleepntsheepRoom Temperature (JOI24_ho_t1)C11
70 / 100
1 ms328 KiB
#include <stdio.h> #include <limits.h> #include <stdlib.h> int compar(const void *i, const void *j) { return *(int*)i - *(int*)j; } int main() { int n, t, i, min, range, k; static int a[1 << 20]; scanf("%d%d", &n, &t); for (i = 0; i < n; ++i) { scanf("%d", a + i); a[i + n] = a[i] % t + t; a[i] = a[i] % t; } qsort(a, 2 * n, sizeof *a, compar); for (i = 0; i < n; ++i) { if (range > (k = a[i + n - 1] - a[i])) { range = k; } } printf("%d\n", (range + 1) / 2); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.c: In function 'main':
Main.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d%d", &n, &t);
      |   ^~~~~~~~~~~~~~~~~~~~~
Main.c:18:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d", a + i);
      |     ^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...