Submission #1035369

#TimeUsernameProblemLanguageResultExecution timeMemory
1035369borisAngelovRoom Temperature (JOI24_ho_t1)C++17
35 / 100
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 500005; int n, t; int a[maxn]; void read() { cin >> n >> t; for (int i = 1; i <= n; ++i) { cin >> a[i]; } } void solve() { int mn = t, mx = 0; for (int i = 1; i <= n; ++i) { int rem = a[i] % t; if (rem > t / 2) rem = rem - t; mn = min(mn, rem); mx = max(mx, rem); } cout << max((mn + mx) / 2 - mn, mx - (mx + mn) / 2) << "\n"; } void fastIO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { fastIO(); read(); solve(); return 0; }
#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...