제출 #1126875

#제출 시각아이디문제언어결과실행 시간메모리
1126875fzyzzz_zRoom Temperature (JOI24_ho_t1)C++20
100 / 100
95 ms2376 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, t; cin >> n >> t; vector<int> a(n); for (auto & x: a) { cin >> x; x %= t; } sort(a.begin(), a.end()); int ans = 1e9; for (int i = 0; i < n; ++i) { int x = a[i], y = a[(i + 1) % n]; if (x > y) x -= t; assert(x <= y); ans = min(ans, (t - (y - x) + 1) / 2); } if (a[0] == a.back()) ans = 0; cout << ans << '\n'; 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...