WALK Solution not accepted.....

help_please
walk

#1

Someone please please help me to figure out what is the difference in the outputs of these two code??
my code for the problem

#include <string>
#include <iostream>
#include <limits.h>
using namespace std;

int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string str; getline(cin, str); int tests = atoi(str.c_str()); while(tests--){ long int n; cin >> n; long int values[n], index = 0, max = 0; for(long int i = 0; i < n; i++){ cin >> values*; } for(long int i = 0; i < n; i++){ if(values* >= max){ max = values*; index = i; } } long int total = (max + index); cout << total << endl; } return 0; }

// some other users code

#include<iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{ int t; cin>>t; while(t--) { long int n,i,w,m=0; cin>>n; for(i=0;i<n;i++) { cin>>w; if(w+i>m) m=w+i; } cout<< m<< endl; } }

Please help to give any test case in which my code fails… As I tested both are giving same ans in all test cases… But codechef is not accepting my ans…


#2

1

5

7 4 5 6 3

Your answer: 7
Correct answer: 9


#3

thank you very much for your help…