Hi there. I tried solving the first problem in Google Kickstart Round D. I received a WA verdict for the “Record Breaker” problem. Can someone point out the problem in my code?
#include<iostream>
using namespace std;
int main() {
long long int testCase = 1;
long long int t;
cin>>t;
while(t--){
long long int n;
cin>>n;
long long int *arr = new long long int[n];
for(long long int i = 0; i<n; i++){
cin>>arr[i];
}
long long int record = 0;
if(arr[0]>arr[1]){
record++;
}
long long int max = arr[0];
for(long long int i = 1; i<n-1; i++){
if(arr[i]>max){
max = arr[i];
if(arr[i]>arr[i+1]){
record++;
}
}
}
if(arr[n-1]>arr[n-2] && arr[n-1]>max){
record++;
}
cout<<"Case #"<<testCase<<": "<<record<<endl;
testCase++;
}
}