제출 #1138716

#제출 시각아이디문제언어결과실행 시간메모리
1138716ThylOneRoom Temperature (JOI24_ho_t1)C++20
35 / 100
26 ms328 KiB
#include<bits/stdc++.h>

#define int long long
using namespace std;

signed main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n,t;cin>>n>>t;
    vector<int> a(n);
    for(int &i:a)cin>>i;
    int ans = 2e9;
    for(int T = 0 ; T <= 3000; T++){
        int maxI = 0;
        for(int j = 0 ; j < n ; j++){
            if(T-a[j]>=0)maxI = max(maxI, T-a[j]);
            else maxI = max(maxI, (-(T-a[j]))%t);
        }
        ans = min(ans, maxI);
    }
    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...