11713 - Abstract Names

All about problems in Volume 117. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
Mohsin Reza Razib
New poster
Posts: 12
Joined: Fri Dec 15, 2006 12:57 pm
Location: Dhaka, Bangladesh
Contact:

11713 - Abstract Names

Post by Mohsin Reza Razib »

I am continuously getting WA for this. Here is my code:

Code: Select all

Accepted removed
Can anyone give any critical output or hint on this. And what should be output for this:
5
pele
pele
jkl
jkl


dfg
dag
bad
bcd
My output are:
No
No
No
No
No
And can anybody explain the problem description:"a name which can be obtained by replacing zero or more vowels by other vowels to obtain a new name are considered same, provided they have same length". Considering this at first my program gave output "Yes" for 4th input and "No" for 5th input. Looking forward to ur reply.
Last edited by Mohsin Reza Razib on Tue Oct 27, 2009 12:55 pm, edited 1 time in total.
Mohsin Reza
"The tragedy of life does not lie in not reaching your goal. The tragedy lies in having no goal to reach".- Benajamin Mays
r2ro
New poster
Posts: 38
Joined: Thu Sep 25, 2008 9:26 am

Re: 11713 Abstract Names getting WA

Post by r2ro »

My Accepted code outputs the following:

Code: Select all

Yes
Yes
Yes
No
No
Mohsin Reza Razib
New poster
Posts: 12
Joined: Fri Dec 15, 2006 12:57 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11713 Abstract Names getting WA

Post by Mohsin Reza Razib »

Thanks Mr. r2ro. I got it accepted. That was so nice of you. I still have complaints about problem specification "a name which can be obtained by replacing zero or more vowels by other vowels to obtain a new name are considered same"
It should be like : "a name which can be obtained by replacing ONE or more vowels by other vowels to obtain a new name are considered same".
Because for input:
dfg
dag
output should be "Yes" if some one follow the problem specification strictly. I got confused there.
Thanks & Regards
Mohsin
Mohsin Reza
"The tragedy of life does not lie in not reaching your goal. The tragedy lies in having no goal to reach".- Benajamin Mays
Taman
New poster
Posts: 32
Joined: Sun Oct 11, 2009 8:59 pm
Location: Southeast University

Re: 11713 Abstract Names getting WA

Post by Taman »

Mohsin Reza Razib wrote:I still have complaints about problem specification "a name which can be obtained by replacing zero or more vowels by other vowels to obtain a new name are considered same"
It should be like : "a name which can be obtained by replacing ONE or more vowels by other vowels to obtain a new name are considered same".
Because for input:
dfg
dag
output should be "Yes" if some one follow the problem specification strictly. I got confused there.

@Razib: I do not think so, if anyone follows the problem he will find that 'f' is not a vowel. So, no question arise to replace it with anything!
If the input were:
dug
dfg
then the same thing occurs. 'u' is a vowel, so it can be replaced but 'f' is not a vowel so 'u' can't be replaced with 'f'!so, if you follow the instruction, the output should be "No" in both cases. obviously your statement is a bit more clear :D.
Mohsin Reza Razib
New poster
Posts: 12
Joined: Fri Dec 15, 2006 12:57 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11713 Abstract Names getting WA

Post by Mohsin Reza Razib »

Taman wrote:
Mohsin Reza Razib wrote:I still have complaints about problem specification "a name which can be obtained by replacing zero or more vowels by other vowels to obtain a new name are considered same"
It should be like : "a name which can be obtained by replacing ONE or more vowels by other vowels to obtain a new name are considered same".
Because for input:
dfg
dag
output should be "Yes" if some one follow the problem specification strictly. I got confused there.

@Razib: I do not think so, if anyone follows the problem he will find that 'f' is not a vowel. So, no question arise to replace it with anything!
If the input were:
dug
dfg
then the same thing occurs. 'u' is a vowel, so it can be replaced but 'f' is not a vowel so 'u' can't be replaced with 'f'!so, if you follow the instruction, the output should be "No" in both cases. obviously your statement is a bit more clear :D.
But consider the case:
dfg
dug
Here 'f' is not a vowel, so that zero vowel at position 2. As we recall from problem specification "a name which can be obtained by replacing zero or more vowels by other vowels", it should be replaced by a vowel like 'u'. So as i get output should be "Yes". Similarly,
jkl
aeu
output should be: "Yes". But for
jkl
aeb
should be: "No". AS 'l' is not replaced by a vowel. Anyway it over now :D . But problem specification should be clear.
Mohsin Reza
"The tragedy of life does not lie in not reaching your goal. The tragedy lies in having no goal to reach".- Benajamin Mays
sadia_atique
New poster
Posts: 25
Joined: Thu Nov 24, 2011 6:32 am

Re: 11713 - Abstract Names

Post by sadia_atique »

I'm continusly getting WA in this problem,so frustrating :cry: can anyone please help me,where's my fault?or give me some critical input?

Code: Select all

#include<stdio.h>
#include<string.h>

int vow(char p)
{
    if(p^'a' && p^'e' && p^'i' && p^'o' && p^'u') return 0;
    else return 1;
}
int main()
{
    int t,i,f;
    char s1[22],s2[22];
    scanf("%d",&t);
    getchar();
    while(t--)
    {
              gets(s1);
              gets(s2);
              f=1;
              if(strlen(s1)==0 && strlen(s2)==0)
              {
                            printf("Yes\n");
                            continue;
                            }
              if(!strcmp(s1,s2))
              {
                                printf("Yes\n");
                                continue;
                                }
              if(strlen(s1)!=strlen(s2))
              {
                                printf("No\n");
                                continue;
                                }      
              for(i=0; i<strlen(s1); i++)
              {
                       if(vow(s1[i]) && !vow(s2[i]))
                       {
                                    printf("No\n");
                                    f=0;
                                    break;
                                    }
                       else if(vow(s2[i]) && !vow(s1[i]))
                       {
                            printf("No\n");
                            f=0;
                            break;
                            }
                       }
              if(f) printf("Yes\n");
              }
              
    return 0;
}
uvasarker
Learning poster
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11713 - Abstract Names

Post by uvasarker »

Apo, Kemon achen? I hear your name from my university's elder brother. Actually I am a new coder I joined Uva at 06-06-2011. So, I can not understand well of your code. So, I give my simple AC code of 11713 and my rank is 170 and Time is 0.004. I will delete my code after your response.......................Shahadat

Code: Select all

I removed my AC code. I understand your code. So, I have given some test case below. Try and get AC, Apo.
uvasarker
Learning poster
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11713 - Abstract Names

Post by uvasarker »

Sample Input

Code: Select all

6
zxv
zxv
pala
palah
palah
pala
pala
pale
nala
pala
nala
pala
Your program

Code: Select all

Yes
No
No
Yes
Yes
Yes
Apo, last two is incorrect because the first character is 'n' and 'p'.
So Correct Output Is

Code: Select all

Yes
No
No
Yes
No
No
Remove This part of your program
if(strlen(s1)==0 && strlen(s2)==0)
{
printf("Yes\n"); // don't print Yes
continue; // don't continue

}
that means if null string or character is given it's nothing that means no '\n' . But, in your program when I input 2 (number of test cases) and press Enter four times your program is terminated, but, never terminated in that case. When strlen is zero it's also nothing don't print 'Yes' .

Good Luck....................Shahadat
sadia_atique
New poster
Posts: 25
Joined: Thu Nov 24, 2011 6:32 am

Re: 11713 - Abstract Names

Post by sadia_atique »

Thanks a lotttt :D ..n sorry I coudn't browse earlier..stupid mistake that forgot to check..
Evan72
New poster
Posts: 11
Joined: Sat Apr 28, 2012 2:01 pm

Re: 11713 - Abstract Names

Post by Evan72 »

getting WA..plz help figure out the problem..

#include<stdio.h>
#include<string.h>

int main()
{
char real[21], game[21];
int length, i, tst;
scanf("%d", &tst);
while(tst--)
{
scanf("%s", real);
scanf("%s", game);
if(strlen(game) != strlen(real))
{
printf("No\n");
continue;
}
else
{
length = strlen(game);
for(i = 0; i < length; i++)
{
if(game == real)
continue;
else if(game == 'a' || game == 'e' || game == 'i' || game == 'o' || game == 'u')
continue;
else
break;
}
}
if(i == length)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11713 - Abstract Names

Post by brianfry713 »

Check if both game and real are vowels if they differ. For input

Code: Select all

2
a
b
b
a
AC output is:

Code: Select all

No
No
Check input and AC output for thousands of problems on uDebug!
Evan72
New poster
Posts: 11
Joined: Sat Apr 28, 2012 2:01 pm

Re: 11713 - Abstract Names

Post by Evan72 »

Thanx bro..got AC :)
hello
New poster
Posts: 25
Joined: Sun Mar 10, 2013 7:29 pm

Re: 11713 - Abstract Names

Post by hello »

Clearly the data set have a great lacking.
I solve this problem in this way

Code: Select all

#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#define LLU long long unsigned int
#define LLD long long double
#define FOR(i,N) for(int i=0;i<(N);i++)
#define Vec vector<int>
#define Vit vector<int>::iterator
#define PI acos(-1)
//define ULLD unsigned __int64 u64
using namespace std;

int main()
{

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    string s;
    string a;
    int cases;
    cin>>cases;
    while(cases--)
    {

        cin>>s;
        cin>>a;
        int flag=1;
        int l1=s.size();
        int l2=a.size();
        if(l1!=l2)cout<<"No"<<endl;
        else
        {
            for(int i=0; s[i]; i++)
            {
                if(a[i]==s[i])flag++;
                else if((s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u') && (a[i]=='a' || a[i]=='e' || a[i]=='i' || a[i]=='o' || a[i]=='u')){
                        flag++;
                }
                else {
                    flag=0;
                    cout<<"No"<<endl;
                    break;
                }
            }
            if(flag!=0)cout<<"Yes"<<endl;
        }
    }


    return 0;
}
later on viewing some thread in this forum I take one of my friend's code & post that. Which is in different logic.

Code: Select all

#include <stdio.h>
#include <string.h>
char str[30],str1[30];
int main()
{
    int n;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%s",str);
        scanf("%s",str1);
        int i=strlen(str);
        int j=strlen(str1);
        if(i!=j)
            printf("No\n");
        else
        {
            int c=0;
            for(i=0; i<j; i++)
            {
                if(str[i]==str1[i])
                {
                    c++;
                }
                else if(str[i]=='a'|| str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
                {
                    c++;
                }
                else
                {
                    c=100;
                }
            }
            if(c>=100)
                printf("No\n");
            else
                printf("Yes\n");
        }
    }
    return 0;
}
The second code not even match the i/o given by brianfry713. Just look for the comment from the GURU @ brianfry713
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11713 - Abstract Names

Post by uDebug »

brianfry713, uvasarker,

Thanks very much for the test input / output.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
Post Reply

Return to “Volume 117 (11700-11799)”