Submission #997951

#TimeUsernameProblemLanguageResultExecution timeMemory
997951MalixRoom Temperature (JOI24_ho_t1)C++14
5 / 100
1 ms428 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef pair<int,int> pi; typedef vector<pi> pii; typedef tuple<int,int,int> tii; #define REP(i,a,b) for(int i=a;i<b;i++) #define F first #define S second #define PB push_back #define MP make_pair #define LSOne(s) ((s)&(-s)) ll INF=1e18+10; int inf=1e9+10; ll M=1e9+7; int main() { //ios::sync_with_stdio(0); //cin.tie(0); //freopen("test_input.txt", "r", stdin); //freopen("test_output.txt", "w", stdout); int n,m;cin>>n>>m; vi a(n); REP(i,0,n)cin>>a[i]; REP(i,0,n)a[i]=min(a[i]%m,m-a[i]%m); sort(a.begin(),a.end()); //cout<<a[0]%m<<" "; int ans=(a[0]+a[n-1])/2+(a[0]+a[n-1])%2; cout<<ans; }
#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...