Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

What's the issue with the following cleanup solution in C?

$
0
0
#include<stdio.h>
int arr[1000],store[1000],result[1000];
int main()
{
    int n,i,k=0,j,m,t,count=0;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d%d",&n,&m);
        for(j=1;j<=m;j++)
        {
            scanf("%d",&arr[j]);
          result[arr[j]]=100;   
        }
        for(j=1;j<=n;j++)
        {
        if(result[j]!=100)
        {
            count++;


                k++;
                store[k]=j;

            }
        }
        for(j=1;j<=count;j=j+2)
        {
            printf("%d ",store[j]);
        }
        printf("\n");
        for(j=2;j<=count;j=j+2)
        {
            printf("%d ",store[j]);
        }
        }

    return 0;
}

Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>