| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1369687 | Charizard2021 | Room Temperature (JOI24_ho_t1) | C++20 | 2090 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, t;
cin >> n >> t;
vector<int> a(1 + n);
for(int i = 1; i <= n; i++){
cin >> a[i];
a[i] %= t;
}
int ans = INT_MAX;
for(int i = 0; i <= t; i++){
int low = 0;
int high = t;
int res = INT_MAX;
while(low <= high){
int mid = (low + high)/2;
bool works2 = true;
for(int j = 1; j <= n; j++){
bool works = false;
if(i - mid <= a[j] && a[j] <= i + mid){
works = true;
}
if(i - mid <= a[j] + t && a[j] + t <= i + mid){
works = true;
}
if(!works){
works2 = false;
break;
}
}
if(works2){
res = mid;
high = mid - 1;
}
else{
low = mid + 1;
}
}
ans = min(ans, res);
}
cout << ans << "\n";
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
