제출 #1201959

#제출 시각아이디문제언어결과실행 시간메모리
1201959ZsofiaKeresztelyRoom Temperature (JOI24_ho_t1)C++20
100 / 100
63 ms4196 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<ll, ll>
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, t;
    cin >> n >> t;
    vector<int> a(n);
    for (int &x : a){
        cin >> x;
        x %= t;
    }
    sort(a.begin(), a.end());
    a.push_back(a[0]+t);
    int op = 0;
    for (int i=1; i<=n; i++){
        op = max(op, a[i] - a[i-1]);
    }
    op = (op == t ? 0 : (t - op - 1) / 2 + 1);
    cout << op;
}
#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...