Page 2 of 2

Re: 11100 - The Trip, 2007

Posted: Fri Aug 22, 2008 9:07 pm
by mak(cse_DU)
Dear Ankit,
Read below statement.
Output an empty line between cases

Re: 11100 - The Trip, 2007

Posted: Thu Aug 19, 2010 1:20 pm
by anis_cuet016
Hlw ......

This problem bugged me a lot ..... at got finally accepted after many try and now at ranked 7 :D .....

btw notedown this things
1. take the input ...

for (long cs = 1; scanf("%ld", &n) == 1 && n > 0; cs++)
{
take_input();
process .....
}

2. print blank line between cases, except last.

check this inputs:
IN:

10
1 1 1 2 2 2 3 3 4 4
10
1 1 1 1 1 2 3 4 5 6
6
1 1 1 1 1 1
10
1 1 1 2 2 2 3 3 3 3

OUT:
3
1 2 3 4
1 2 3
1 2 4

5
1 2
1 3
1 4
1 5
1 6

6
1
1
1
1
1
1

4
1 2 3
1 2 3
1 3
2 3

Hope it helps .......

Re:

Posted: Tue Sep 14, 2010 8:27 am
by Ahshua
ankit.arora wrote:hi! I am getting WA can anyone please help me out..... here's my code!

Code: Select all

#include<iostream>
using namespace std;

int main()
{
        int n,i,j,count,max,temp,prev;
        int arr[10010];
        while(cin>>n)
        {
                     if(n==0)
                     break;
                     
                     for(i=0;i<n;i++)
                     cin>>arr[i];
                     
                     for(i=0;i<n;i++)
                     {
                                     for(j=i;j<n;j++)
                                     {
                                                     if(arr[i]>arr[j])
                                                     {
                                                                      temp=arr[j];
                                                                      arr[j]=arr[i];
                                                                      arr[i]=temp;
                                                     }
                                     }
                     }
                     max=1;
                     count=1;
                     for(i=1;i<n;i++)
                     {
                                     if(arr[i-1]==arr[i])
                                     count++;
                                     
                                     else if(count>max)
                                     {
                                          max=count;
                                          count=1;
                                     }
                                     
                                     else
                                     count=1;
                     }    
                     cout<<max<<"\n";
                     for(i=0;i<max;i++)
                     {
                                     cout<<arr[i];  
                                     for(j=i+max;j<n;j+=max)
                                     cout<<" "<<arr[j];
                                     cout<<"\n";
                     }
                     
                     cout<<"\n";           
        }
}
Thanks!!!!
Hi,Pay attention to Output an empty line between cases ,please!
Try Output an empty line between cases again,you'll be surprise! :wink:

Re: 11100 - The Trip, 2007

Posted: Wed Jul 31, 2013 8:10 am
by dibery
in:

10
1 2 4 2 3 2 3 3 3 3

possible out:
1 3
2 3
2 3
2 3
4 3