Problem C-Workout
For subtask 1
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define lld long long int
int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lld t;
cin>>t;
for(int j=1;j<=t;j++)
{
int n,k;
cin>>n>>k;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
multiset <int> s;
for(int i=1;i<n;i++)
s.insert(arr[i]-arr[i-1]);
set <int> :: iterator it= --s.end();
int val=*it;
it--;
cout<<"Case #"<<j<<": ";
if(val==1)
cout<<1<<"\n";
else if(val%2==0)
cout<<max(*it,val/2)<<"\n";
else
cout<<max(*it,val/2+1)<<"\n";
}
}
This is giving WA