Submission #1364801

#TimeUsernameProblemLanguageResultExecution timeMemory
1364801kawhietRoom Temperature (JOI24_ho_t1)C++20
35 / 100
0 ms344 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, t;
    cin >> n >> t;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] %= t;
        if (2 * a[i] > t) {
            a[i] = t - a[i];
        }
    }
    sort(a.begin(), a.end());
    cout << (a[n - 1] - a[0] + 1) / 2 << '\n';
    return 0;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...