Submission #1002512

#TimeUsernameProblemLanguageResultExecution timeMemory
1002512kwongwengRoom Temperature (JOI24_ho_t1)C++17
35 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef vector<vector<ll>> vll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define pb push_back #define ms memset #define fi first #define se second ll MOD = 998244353; ll power(ll base, ll n){ base %= MOD; if (n==0) return 1; ll halfn = power(base,n/2); if (n%2==0) return (halfn*halfn)%MOD; return (((halfn*halfn)%MOD)*base)%MOD; } void solve(){ int n,T; cin>>n>>T; vi a(n); FOR(i,0,n) cin>>a[i]; FOR(i,0,n) a[i]%=T; sort(a.begin(), a.end()); cout<<a[n-1]-a[0]<<"\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int TC = 1; //cin>>TC; while (TC--){ solve(); } return 0; }
#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...