×

# WALK Solution not accepted.....

 0 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  #include  #include  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[i]; } for(long int i = 0; i < n; i++){ if(values[i] >= max){ max = values[i]; index = i; } } long int total = (max + index); cout << total << endl; } return 0; } // some other users code #include #include using namespace std; int main() { int t; cin>>t; while(t--) { long int n,i,w,m=0; cin>>n; for(i=0;i>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.. asked 13 Jun, 19:40 1 accept rate: 0% 14.4k●1●16●53

 0 1 5 7 4 5 6 3 Your answer: 7 Correct answer: 9 answered 13 Jun, 20:13 421●8 accept rate: 16% thank you very much for your help.... (21 Jun, 18:01)
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×197
×5