Are you the kind of person who spends sleepless nights learning new algorithms and working out your brain through the trickiest of problems? Do you use data structures as if it’s your sword and algorithms being your armour? Is code the language you speak?
Then get ready with your laptops and put your brains in use cause this Aarohan 2021, Decathlon is the perfect opportunity for you to show off your skills and win cool goodies and vouchers worth Rs 50,000 !
So, bring out the code warrior within you and put the destruction mode on 4th April.
The contest will be held on the Codechef platform.
The contest consists of 6 problems to be solved in 2 hours.
Laddus would be given to top 3 winners from the global rank list.
Vouchers worth 10k INR will be given to top 2 performers from NIT Durgapur
I guess you are talking about thishttps://codeforces.com/contest/1498/problem/B problem. There’s a clear difference between both the problems, the array elements in the problem B of codeforces round are powers of two which is not the case here.
Here’s a case where the greedy solutions fail
1
6 13
6 6 4 4 3 3
The correct answer is 2 whereas the greedy solution gives 3.
The problem that came in codeforces has a special condition i.e. Each rectangle’s width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
So, in codeforces problem the greedy solution works fine BUT it will not work in this problem
Hi! Could you please guide me with where I’m going wrong with this from the problem “YAD786”? I’m pretty sure this was the method supposed to be used, but I still keep getting a WA
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
int t;
cin>>t;
while(t--)
{
string a,b;
cin>>a>>b;
int moh=0,rash=0;
for(int i=0;i<a.size();++i){
moh+=(a[i]-'a');
}
for(int i=0;i<b.size();++i){
rash+=(b[i]-'a');
}
int dif = abs(moh-rash);
if(dif>=1 && dif<=10) cout<<"Rashmi\n";
else if(dif==0) cout<<"No One\n";
else cout<<"Mohit\n";
}
}