
11348 - Exhibition
Moderator: Board moderators
11348 - Exibition
can anybody give me some critical cases for this problem?? Um feeling helpless by getting WA for many times 

Re: 11348 - Exibition
I think this is the Key line of this problem "The percent of whole income that i-th friend will get is equal to the part of his unique stamp's type."
I got several times WA but finally got the thing & get ACC.
Try this I/O:
Input:
Output:
I got several times WA but finally got the thing & get ACC.
Try this I/O:
Input:
Code: Select all
3
3
3 1 1 2
2 4 5
3 4 2 6
3
3 2 2 2
2 4 4
3 5 5 5
3
3 0 1 0
2 4 10000
3 4 2 2
Code: Select all
Case 1: 33.333333% 33.333333% 33.333333%
Case 2: 33.333333% 33.333333% 33.333333%
Case 3: 50.000000% 25.000000% 25.000000%
Re: 11348 - Exhibition
I think this is the Key line of this problem "The percent of whole income that i-th friend will get is equal to the part of his unique stamp's type."
I got several times WA but finally got the thing & get ACC.
Try this I/O:
Input:
Output:
I got several times WA but finally got the thing & get ACC.
Try this I/O:
Input:
Code: Select all
3
3
3 1 1 2
2 4 5
3 4 2 6
3
3 2 2 2
2 4 4
3 5 5 5
3
3 0 1 0
2 4 10000
3 4 2 2
Code: Select all
Case 1: 33.333333% 33.333333% 33.333333%
Case 2: 33.333333% 33.333333% 33.333333%
Case 3: 50.000000% 25.000000% 25.000000%
Re: 11348 - Exibition
here this is my code..and I cant find any bug..please help me.....
removed after acc...
thank you mahedi...
removed after acc...
thank you mahedi...
Last edited by amin__ on Wed Aug 17, 2011 2:13 pm, edited 1 time in total.
Re: 11348 - Exibition
@Amin
I think your code is almost right. Just change data type for some variable or use type casting, like use "double usum,sum[]". In your last output section within loop i think no need to use else{},becoz sum[] already hold 0.00.
I think your code is almost right. Just change data type for some variable or use type casting, like use "double usum,sum[]". In your last output section within loop i think no need to use else{},becoz sum[] already hold 0.00.
Re: 11348 - Exhibition
is my code is wrong?
#include<cstdio>
#include<cstring>
#include<map>
#include<vector>
using namespace std;
int main()
{
/* freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
int test,y=1;
scanf("%d",&test);
while(test--)
{
int n;
map<int,int>stamp;
scanf("%d",&n);
vector<int>member[n];
for(int i=0;i<n;i++)
{
int m;
scanf("%d",&m);
while(m--)
{
int s,j;
scanf("%d",&s);
for( j=0;j<member.size();j++)
{
if(s==member[j])break;
}
if(j==member.size()){
member.push_back(s);stamp[s]=stamp[s]+1;}
}//printf("\n");
}
double count[n],total=0;
for(int i=0;i<n;i++)
{
count==0.0;
for(int j=0;j<member.size();j++)
{
int s=member[j];
//printf (" %d ",stamp[s]);
if(stamp[s]==1)
{
total=total+1.0;
count=count+1.;
}
}
}
printf("Case %d: %.6lf%c",y++,(double)count[0]*100/(double)total,37);
for(int i=1;i<n;i++)
{
printf(" %.6lf%c",(double)count*100/(double)total,37);
}
printf("\n");
}
return 0;
}
#include<cstdio>
#include<cstring>
#include<map>
#include<vector>
using namespace std;
int main()
{
/* freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
int test,y=1;
scanf("%d",&test);
while(test--)
{
int n;
map<int,int>stamp;
scanf("%d",&n);
vector<int>member[n];
for(int i=0;i<n;i++)
{
int m;
scanf("%d",&m);
while(m--)
{
int s,j;
scanf("%d",&s);
for( j=0;j<member.size();j++)
{
if(s==member[j])break;
}
if(j==member.size()){
member.push_back(s);stamp[s]=stamp[s]+1;}
}//printf("\n");
}
double count[n],total=0;
for(int i=0;i<n;i++)
{
count==0.0;
for(int j=0;j<member.size();j++)
{
int s=member[j];
//printf (" %d ",stamp[s]);
if(stamp[s]==1)
{
total=total+1.0;
count=count+1.;
}
}
}
printf("Case %d: %.6lf%c",y++,(double)count[0]*100/(double)total,37);
for(int i=1;i<n;i++)
{
printf(" %.6lf%c",(double)count*100/(double)total,37);
}
printf("\n");
}
return 0;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11348 - Exhibition
Yes your code is wrong, it doesn't match the sample I/O.
Check input and AC output for thousands of problems on uDebug!
Re: 11348 - Exhibition
Here's some input / output that helped me test / debug my program.
Input:
AC Output:
Input:
Code: Select all
10
3
3 1 1 2
2 4 5
3 4 2 6
3
3 2 2 2
2 4 4
3 5 5 5
3
3 0 1 0
2 4 10000
3 4 2 2
0
1
0
1
1 1
3
3 1 1 2
2 4 4
3 4 2 6
4
0
0
0
1 444
4
10 2 2 2 2 2 2 2 2 2 3
2 2 2
3 2 2 2
1 2
5
2 1 5
2 2 4
2 3 3
2 4 2
2 5 1
Code: Select all
Case 1: 33.333333% 33.333333% 33.333333%
Case 2: 33.333333% 33.333333% 33.333333%
Case 3: 50.000000% 25.000000% 25.000000%
Case 4:
Case 5:
Case 6: 100.000000%
Case 7: 50.000000% 0.000000% 50.000000%
Case 8: 0.000000% 0.000000% 0.000000% 100.000000%
Case 9: 100.000000% 0.000000% 0.000000% 0.000000%
Case 10: 0.000000% 0.000000% 100.000000% 0.000000% 0.000000%
-
- New poster
- Posts: 2
- Joined: Wed Jul 24, 2013 7:36 am
Uva Problem - 11348 - Exhibition
I am trying to solve this problem using maps in C++-STL, I think the logic that I am applying to solve this problem is correct, but it keeps giving me wrong answer, somewhere I feel I am committing a formatting mistake, can somebody help me point out what mistake either in logic or writing the output am I committing in my code.
Thanks a lot in advance
Thanks a lot in advance

Last edited by ankitsablok89 on Tue Jul 15, 2014 7:18 pm, edited 1 time in total.
-
- New poster
- Posts: 2
- Joined: Wed Jul 24, 2013 7:36 am
Re: Uva Problem - 11348 - Exhibition
forget it I got the error, was committing a silly mistake 
