Submission #1087490

#TimeUsernameProblemLanguageResultExecution timeMemory
1087490HienTDRoom Temperature (JOI24_ho_t1)C++14
100 / 100
204 ms7252 KiB
#include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int N, T; cin >> N >> T; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { A[i] %= T; } sort (A.begin(), A.end()); int len_min = A[N-1] - A[0]; for (int i = 0; i < N-1; i++) { len_min = min(len_min, T - (A[i+1] - A[i])); } cout << (len_min + 1) / 2 << endl; 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...