Why my code is getting WA ??? I have checked all the possible input from uDebug & UVa OJ Board. Still getting WA. Anyone please help me .
Problem : Uva 12032 — The Monkey and the Oiled Bamboo Here is my Code ---
include<bits/stdc++.h>
using namespace std;
map <long long,long long> mp; int main() { // freopen ("myfile.txt","w",stdout);
int tc,kase=1;
scanf("%d",&tc);
while(tc--)
{
mp.clear();
long long ara[100001],pa;
long long n,mx=0,a,diff;
scanf("%lld",&n);
scanf("%lld",&ara[0]);
mx=ara[0];
mp[mx]++;
a=mx-1;
for(long long int i=1; i<n; i++)
{
scanf("%lld",&ara[i]);
diff=ara[i]- ara[i-1];
mp[diff]++;
if(diff==a)
a--;
else if(diff==mx)
{
if(mp[mx]>1)
{
mp[mx]=0;
mx++;
a=mx-1;
}
}
else if(diff>a)
{
if(mx<diff)
mx = diff;
else if(diff<mx)
mx++;
a=mx-1;
}
// cout<<" diff = "<<diff<<" . mx = "<<mx<<" . ability = "<<a<<endl;
}
printf("Case %d: %lld\n",kase++,mx);
}
// fclose(stdout);}








