Submission #1127871

#TimeUsernameProblemLanguageResultExecution timeMemory
1127871sleepntsheepRoom Temperature (JOI24_ho_t1)C11
35 / 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, 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; }

Compilation message (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...