Submission #1059823

#TimeUsernameProblemLanguageResultExecution timeMemory
1059823anangoRoom Temperature (JOI24_ho_t1)C++17
100 / 100
184 ms14932 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int INF = 1LL<<30; signed main() { #ifndef ONLINE_JUDGE // for getting input from input.txt //freopen("input.txt", "r", stdin); // for writing output to output.txt //freopen("output.txt", "w", stdout); #endif /*#ifdef ONLINE_JUDGE ios_base::sync_with_stdio(false); cin.tie(NULL); #endif*/ //fast IO int n,t; cin >> n >> t; vector<int> r(n); for (int i=0; i<n; i++) { int x; cin >> x; r[i] = x%t; } sort(r.begin(), r.end()); r.push_back(r.front()+t); int ma = -1; for (int i=0; i<n; i++) { ma=max(ma,r[i+1]-r[i]); } int sub = ((ma)-(t%2))/2; int start = t/2; int ans = start-sub; cout << ans << 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...