# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1127872 | sleepntsheep | Room Temperature (JOI24_ho_t1) | C11 | 1 ms | 328 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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |