ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1025. Democracy in Danger

why wrong answer # test case 5
Posted by Anupam Patel 7 Oct 2018 18:28
Hello ,
Can someone please tell me why I am getting wrong answer for test case 5?
I have used straight forward approach.
```
#include <stdio.h>
  2
  3 int group_distribution[10001];
  4
  5 void insertion_sort( int * arr, int size) {
  6     int i , j, key;
  7     for ( i = 1; i < size; i ++ ) {
  8         key = arr[i];
  9         j = i - 1;
 10         while ( arr[j] > key && j >= 0 ) {
 11             arr[j + 1] = arr[ j ];
 12             j = j - 1;
 13         }
 14         arr[ j + 1 ] = key;
 15     }
 16 }
 17
 18 int main( int argc, char **argv) {
 19     int k, ans = 0, i ;
 20     scanf("%d",&k);
 21     for ( i = 0; i < k ; i ++)
 22         scanf("%d",&group_distribution[i]);
 23     insertion_sort(group_distribution, k);
 24     for ( i = 0; i < (k+1)/2 ; i++ ) {
 25         ans += (group_distribution[0]+1)/2 ;
 26     }
 27     printf("%d\n",ans);
 28     return 0;
 29 }
```