Itsy's Magic Cards

Itsy needs your help with her magic cards. Her magic cards grant her special spider-witch powers. Un…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

THis ProBlem IS in easy catagory?

Continuing the discussion from Itsy's Magic Cards:

#include <stdio.h>

int main()
{
	int a,b,x,y,i,j=0,k,ara2[150],max=0;
	char ara[60];
	scanf("%d %d",&a,&b);
	x=a;
	y=b;
	for(i=0;i<b*2;i=i+2){
		scanf(" %c %c",&ara[i],&ara[i+1]);
		k=ara[i];
		ara2[k]++;
		k=ara[i+1];
		ara2[k]++;
	}
	while(y>0){
		j=0;
		for(i=65;i<=64+a;i++){
			if(ara2[i]>j) {
				max=i;
				j=ara2[i];
			}
			ara2[max]=0;
		}
		for(i=0;i<y*2;i++){
			if(ara[i]==max){
				ara[i]='0';
				if(i%2==1) {
					k=ara[i-1];
					ara2[k]--;					
					ara[i-1]='0';

			}
			else{
				k=ara[i+1];
				ara2[k]--;
				ara[i+1]='0';
			}
			}
		}
		y=y-j;
		x--;
	}
	printf("%d\n",x);
	return 0;
}

What is wrong in this program?

prim ta ki bujai lo???

this is based on bitmask dp right? i’m getting runtime error using python.
code link: 5CwLrP - Online Python3 Interpreter & Debugging Tool - Ideone.com

can anybody explain the problem in details

did you solved it? hmm?

m, n = map(int, input().split())
arr = []
for i in range(n):
    arr.append(list(map(str, input().split())))

for item in arr:
    if ord(item[0]) + 1 == ord(item[1]):
        m -= 1
    elif ord(item[0]) - 1 == ord(item[1]):
        m -= 1
print(m)

Wrong answer on test 2
**please help me!**:pleading_face:

@hjr265 Getting Wrong output at #3
Don’t know where am i doing it wrong, can you please point out the reason!

n,m = map(int, input().split())
dic = {}
l = []
for i in range(m):
  a,b = input().split()
  l.append(a+b)
  dic[a] = dic[a]+1 if a in dic else 1
  dic[b] = dic[b]+1 if b in dic else 1
  
s = [x for x,v in sorted(dic.items(),key = lambda itm:itm[1],reverse=True)]

w = []

for k in s:
  for p in l:
    if len(p)>1 and k in p:
      l[l.index(p)] = p.replace(k, '')
      w.append(k)
print(n-len(set(w)))