12247 - Jollo
Moderator: Board moderators
-
- New poster
- Posts: 10
- Joined: Sun Mar 17, 2013 12:02 am
12247 - Jollo
hi all
can anyone help me with some test cases I'm getting WA by this code:
http://ideone.com/Xn4GeO
Thanks in advance
can anyone help me with some test cases I'm getting WA by this code:
http://ideone.com/Xn4GeO
Thanks in advance
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12247 - Jollo
Input:AC output:
Code: Select all
11 17 4 16 39
32 18 14 8 30
50 46 51 23 5
44 32 45 40 21
34 43 52 37 27
19 27 23 18 52
1 4 17 32 47
31 12 41 44 47
44 35 19 12 22
16 45 40 15 5
42 34 32 40 27
31 41 6 23 20
1 6 10 40 49
49 7 31 44 18
28 35 38 15 49
8 4 7 14 3
27 42 3 9 6
23 10 39 8 25
11 33 32 17 52
25 44 34 11 6
6 29 37 12 26
3 47 5 10 8
7 12 25 38 48
6 2 24 13 18
18 9 51 2 48
52 33 43 5 18
26 39 5 27 24
51 42 1 50 2
47 20 14 31 51
13 49 35 11 26
7 11 34 49 43
51 50 29 31 52
29 7 8 12 15
33 29 2 22 36
28 34 8 10 21
33 16 31 43 40
49 17 14 1 48
13 29 2 20 40
44 26 25 47 9
7 3 37 36 24
20 11 34 27 21
52 4 18 13 32
41 25 9 42 21
24 33 22 25 3
49 15 52 9 22
32 7 20 16 24
11 15 18 16 5
8 48 19 37 33
7 33 23 6 41
33 50 30 13 35
41 23 50 34 14
30 42 9 48 26
17 30 34 39 35
23 6 16 18 25
43 9 24 23 19
38 3 16 15 43
51 31 42 24 12
13 34 52 4 51
25 46 35 24 45
1 9 23 17 51
16 33 18 45 48
18 50 28 48 9
22 36 42 49 39
17 21 9 51 44
1 52 28 23 44
2 12 34 6 14
18 34 39 45 29
24 42 40 13 39
2 5 35 10 32
3 38 7 6 9
50 8 20 7 13
27 49 29 42 18
5 13 7 20 1
21 22 6 4 7
37 34 45 19 39
1 16 46 48 50
35 5 30 44 12
25 19 37 2 8
20 5 23 1 36
5 13 17 49 31
0 0 0 0 0
Code: Select all
12
-1
-1
-1
-1
28
2
1
-1
-1
-1
-1
2
-1
39
9
-1
-1
34
-1
-1
6
1
7
-1
-1
-1
-1
21
-1
1
-1
9
34
-1
1
-1
14
45
8
22
-1
43
-1
-1
-1
-1
20
34
-1
-1
43
1
17
-1
39
-1
-1
-1
10
1
-1
37
1
-1
-1
40
-1
6
-1
-1
-1
14
-1
-1
2
36
-1
24
1
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 10
- Joined: Sun Mar 17, 2013 12:02 am
Re: 12247 - Jollo
can u believe it? my program answers all your inputs correctly but I still get WA
http://ideone.com/lECjLS
(actually I change that a little for equal cards)
http://ideone.com/lECjLS
(actually I change that a little for equal cards)
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12247 - Jollo
Input:AC output:
Code: Select all
33 2 20 21 22
0 0 0 0 0
Code: Select all
23
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 10
- Joined: Sun Mar 17, 2013 12:02 am
Re: 12247 - Jollo
its killing me new code is http://ideone.com/MFaQWf#ul_inouterr
but still wrong answer help plz
but still wrong answer help plz
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12247 - Jollo
Input:AC output:
Code: Select all
4 30 35 32 31
0 0 0 0 0
Code: Select all
33
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 4
- Joined: Sun Jun 22, 2014 6:00 am
Re: 12247 - Jollo
there are some wrong inputs in your testsbrianfry713 wrote:Input:AC output:Code: Select all
11 17 4 16 39 32 18 14 8 30 50 46 51 23 5 44 32 45 40 21 34 43 52 37 27 19 27 23 18 52 1 4 17 32 47 31 12 41 44 47 18 42 40 16 40 44 35 19 12 22 16 45 40 15 5 42 34 32 40 27 31 41 6 23 20 1 1 7 41 45 1 6 10 40 49 49 7 31 44 18 28 35 38 15 49 43 4 6 50 43 8 4 7 14 3 27 42 3 9 6 23 10 39 8 25 11 33 32 17 52 25 44 34 11 6 6 29 37 12 26 3 47 5 10 8 7 12 25 38 48 6 8 33 44 44 6 2 24 13 18 23 37 37 4 23 18 9 51 2 48 52 33 43 5 18 26 39 5 27 24 52 32 8 9 52 51 42 1 50 2 47 20 14 31 51 13 49 35 11 26 7 11 34 49 43 51 50 29 31 52 29 7 8 12 15 7 10 4 7 35 33 29 2 22 36 28 34 8 10 21 33 16 31 43 40 49 17 14 1 48 13 29 2 20 40 44 26 25 47 9 7 3 37 36 24 20 11 34 27 21 2 36 36 8 2 52 4 18 13 32 41 25 9 42 21 24 33 22 25 3 30 31 5 43 43 5 38 1 38 41 49 15 52 9 22 1 8 1 18 20 32 7 20 16 24 40 40 33 10 12 11 15 18 16 5 8 48 19 37 33 7 33 23 6 41 44 6 48 44 51 15 51 33 35 15 33 50 30 13 35 41 23 50 34 14 30 42 9 48 26 17 30 34 39 35 23 6 16 18 25 43 9 24 23 19 38 3 16 15 43 51 31 42 24 12 3 29 29 40 1 30 32 30 12 47 13 34 52 4 51 25 46 35 24 45 1 9 23 17 51 14 43 29 3 14 16 33 18 45 48 18 50 28 48 9 22 36 42 49 39 17 21 9 51 44 1 52 28 23 44 2 12 34 6 14 23 22 23 16 42 18 34 39 45 29 24 42 40 13 39 2 5 35 10 32 3 38 7 6 9 50 8 20 7 13 10 5 10 32 20 27 49 29 42 18 5 13 7 20 1 21 22 6 4 7 37 34 45 19 39 1 16 46 48 50 35 5 30 44 12 25 19 37 2 8 2 34 20 36 2 20 5 23 1 36 5 13 17 49 31 0 0 0 0 0
Code: Select all
12 -1 -1 -1 -1 28 2 1 -1 -1 -1 -1 -1 2 2 -1 39 1 9 -1 -1 34 -1 -1 6 1 1 7 -1 -1 -1 -1 -1 -1 21 -1 1 -1 9 8 34 -1 1 -1 14 45 8 22 -1 -1 43 -1 1 2 -1 2 -1 -1 -1 20 34 45 -1 -1 -1 43 1 17 -1 39 -1 30 33 -1 -1 10 -1 1 -1 37 1 -1 -1 24 40 -1 6 -1 -1 1 -1 14 -1 -1 2 36 -1 35 24 1
Code: Select all
43 4 6 50 43
7 10 4 7 35
5 38 1 38 41
44 6 48 44 51
but thanks for the other cases
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
-
- New poster
- Posts: 4
- Joined: Sat Dec 27, 2014 9:06 am
Re: 12247 - Jollo
Code: Select all
#include <iostream>
#include <algorithm>
using namespace std;
void shift(int c[],int j,int t)
{
for(int i=j+1;i<t;i++)
{
c[i-1]=c[i];
}
}
int main() {
int g[3],b[2],z[5];
while(cin>>g[0]>>g[1]>>g[2]>>b[0]>>b[1] && ((g[0]+g[1]+g[2]+b[1]+b[2])!=0))
{
sort(g,g+3);
sort(b,b+2);
merge(g,g+3,b,b+2,z);
int i,j;
int gw=0,bw=0;
int gc=3,bc=2;
for(i=1;i>=0;i--)
{
bool ne=true;
for(j=0;j<gc;j++)
{
if(g[j]>b[i])
{
ne=false;
gw++;
shift(g,j,gc);
gc--;
break;
}
}
if(ne)
{
bw++;
shift(g,0,gc);
gc--;
}
}
if(!bw)
cout<<"-1"<<endl;
else if(bw==2)
{
i=1;
while(true)
{
if(find(z,z+5,i)==(z+5))
{
cout<<i<<endl;
break;
}
else
{
i++;
}
}
}
else
{
g[0]=g[0]+1;
bool not_ans=true;;
while(g[0]<=52)
{
if(find(z,z+5,g[0])==(z+5))
{
cout<<g[0]<<endl;
not_ans=false;
break;
}
else
{
g[0]++;
}
}
if(not_ans)
cout<<"-1"<<endl;
}
}
return 0;
}
but after submission I get WA. Why ? plz plz reply me
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12247 - Jollo
Try changing line 14 to:
while(cin>>g[0]>>g[1]>>g[2]>>b[0]>>b[1] && ((g[0]+g[1]+g[2]+b[0]+b[1])!=0))
while(cin>>g[0]>>g[1]>>g[2]>>b[0]>>b[1] && ((g[0]+g[1]+g[2]+b[0]+b[1])!=0))
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 4
- Joined: Sat Dec 27, 2014 9:06 am
Re: 12247 - Jollo
After changing in line 14 to
while(cin>>g[0]>>g[1]>>g[2]>>b[0]>>b[1] && g[0] && g[1] && g[2] && b[1] && b[2])
I got accepted thanks to BRIANFRY(guru)
while(cin>>g[0]>>g[1]>>g[2]>>b[0]>>b[1] && g[0] && g[1] && g[2] && b[1] && b[2])
I got accepted thanks to BRIANFRY(guru)
Re: 12247 - Jollo
Hello there, I'm trying to solve this problem but I get RE anyway. I already try the test cases of uDebug (by brianfry) and I get the same accepted answers.
Here is my code.
https://ideone.com/WyvKLy
Thank's in advance.
Here is my code.
https://ideone.com/WyvKLy
Code: Select all
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
using namespace std;
bool endIn(int a, int b, int c, int d, int e)
{
if (a == 0 && b == 0 && c == 0 && d == 0 && e == 0)
return false;
return true;
}
int compare(const void * a, const void * b)
{
return (*(int*)a - *(int*)b);
}
bool check[52];
int main()
{
int p1[3], p2[2], aux, c=0, max, maxind;
int z[3] = {0, 0, 0};
bool flag, win[2], sup[3];
while (scanf("%d %d %d %d %d", &p1[0], &p1[1], &p1[2], &p2[0], &p2[1]), endIn(p1[0], p1[1], p1[2], p2[0], p2[1]))
{
qsort(p1, 3, sizeof(int), compare);
qsort(p2, 2, sizeof(int), compare);
memset(check, false, sizeof(check));
memset(z, 0, sizeof(z));
memset(win, false, sizeof(win));
memset(sup, false, sizeof(sup));
flag = false;
c = max = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 2; j++)
{
if (p1[i] > p2[j]){
z[i]++;
if( !win[j] && !sup[i])
{
win[j] = true;
sup[i] = true;
}
}
}
}
for(int i = 0; i < 3; i++)
{
if(z[i] > 0)
c += z[i];
if(z[i] > 2)
{
flag = true;
aux = i;
}
}
if (c >= 4 || (win[0] && win[1]) || (p1[1] == 50 && p1[2] == 51))
{
printf("-1\n");
continue;
}
check[p1[0]] = true;
check[p1[1]] = true;
check[p1[2]] = true;
check[p2[0]] = true;
check[p2[1]] = true;
if(flag)
{
for(int i = 0; i < 3; i++)
{
if( i != aux )
{
if(p1[i] > max)
{
max = p1[i];
maxind = i;
}
}
}
aux = max;
}
else
{
if(c == 3)
{
aux = p1[2];
maxind = 2;
}
else if( c == 0)
{
aux = 1;
maxind = 0;
}
else if( c == 1 )
{
aux = p1[1];
maxind = 1;
}
else
{
aux = z[2] == 2 ? p1[1] : p1[2];
maxind = z[2] == 2 ? 1 : 2 ;
}
}
while (check[aux])
if(aux < 52)
aux++;
else
{
aux = p1[--maxind];
c++;
}
printf("%d\n", aux);
}
return 0;
}