Submission #1057450

#TimeUsernameProblemLanguageResultExecution timeMemory
1057450sammyuriRoom Temperature (JOI24_ho_t1)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, t; cin >> n >> t; vector<int> nums(n); for (auto &a : nums) { cin >> a; a %= t; } sort(nums.begin(), nums.end()); // find largest gap in the numbers, then it is optimal to choose the // opposite point of that gap int best = t; for (int i = 0; i < n; i ++) { int gap = (nums[(i + 1) % n] - nums[i] + t) % t; int kk = t - gap; // cout << kk << endl; best = min(best, (kk + 1) / 2); } cout << best << endl; }
#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...