« first day (2499 days earlier)      last day (421 days later) » 

06:03
@JohnRennie Hi
06:36
@KavinIshwaran Hi :-)
07:19
@JohnRennie Hi! Are you free?
My solution:
int traffic(int n, int m, vector<int> v) {
	int ans=0;
	for(int i=0;i<n;i++){
        int j=i;
		int t=0;
        while(j<n){
            if(v[j]==0){
              if (m > 0) {
                m--;
				t++;
              }
            }
			else{
				t++;
			}
            j++;
        }
        ans=max(ans,t);
    }
    return ans;
}
It seems to work fine on some test cases
Here the code if you want to run on some compiler
#include <bits/stdc++.h>
using namespace std;
int traffic(int n, int m, vector<int> v) {
	int ans=0;
	for(int i=0;i<n;i++){
        int j=i;
		int t=0;
        while(j<n){
            if(v[j]==0){
              if (m > 0) {
                m--;
				t++;
              }
            }
			else{
				t++;
			}
            j++;
        }
        ans=max(ans,t);
    }
    return ans;
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    while (t--)
    {
        int n, m;
        cin >> n >> m;
It works fine on
3 1
0 1 1
and
6 3
0 1 0 0 1 0
and
25 17
1 0 1 1 1 1 1 0 1 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 0
and
36 32
0 1 1 0 1 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0
But
781 318
0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 1 1 0 1 0 1 1 0 1 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 1 0 0 1 1 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1
It gives 691
but expected answer is 622
@JohnRennie What am I missing?
So your method is to start at 0 then flip the next M zeros and count the number of consecutive 1s.
Then start a 1 and do the same, then start at 2 and so on.
So you should be finding the maximum possible number of consecutive 1s by trying every possible starting point for the 1s.
Yes?
@JohnRennie Yes (though I am not changing the vector)
@JohnRennie Yes
You have:
            if(v[j]==0){
              if (m > 0) {
                m--;
		t++;
              }
            }
But if v[j] == 0 and m == 0 shouldn't you have a break to exit the while loop?
07:34
Yes
Ohk
Thanks
:D
You're welcome :-)
The simple bugs are often the hardest to spot!
@JohnRennie Hi !
So power dissipated in the circuit is F.V
and through that I attempted to find the force required to deliver constant power
I'm answering another question now. I'll look at this as soon as I'm free.
08:35
@KavinIshwaran Hi
@JohnRennie Hi !
Yes, I think calculating the power is the correct approach.
In that problem I was stuck in finding equation for power dissipation in the circuit
The voltage is constant. Yes?
current through the capacitor as a function of time in constant voltage I found to be i_0 e^-t/RC
@JohnRennie Yes
08:38
Yes, the current is I = V/R exp(-t/RC), and the power is W = VI.
So W = V²/R exp(-t/RC)
where you get V from V = dΦ/dt
Yes?
Yes
V = Blv
So W = (B𝓁v)²/R exp(-t/RC)
Should we need to add the power dissipation in resistor also ?
And as you say W = Fv
08:41
@KavinIshwaran No. Power is consumed in both the resistor and the capacitor. In the resistor it gets converted to heat and in the capacitor it gets converted to an electric field.
All you need is the total power supplied and that's just VI.
Ah Ok I get it
@JohnRennie How to do this ?
With the switch open we have three plates with a charge Q₀ on the left plate. Yes?
So we can figure out the charge distributions using the usual rules for plates, and then get the potential differences between the plates. Yes?
08:56
The charge is going to be Q₀/2 at the surface of each plate.
Now if we connect the right pair of plates they effectively become single plate and the charges change to:
Yes?
@KavinIshwaran Hello ... ?
09:15
@JohnRennie Sorry, I don't know why "There seems to be a problem connecting to the server." message keeps on appearing on top even though my network is fine
Now it disappeared
Hi :-)
@JohnRennie Yes
@KavinIshwaran So we basically just have a capacitor discharging though an inductor i.e. it is a parallel LC circuit, and the time constant is 1/√LC. Yes?
It's this capacitor in parallel with the inductor and none of the other charges are changing.
So if you look at the charge on the red surfaces we get:
Q(t) = ¹⁄₂Q₀ cos(ωt)
09:23
Yes
as the charge oscillates through the inductor.
So basically we have LC oscillations ?
Yes, with ω = 1/√LC
Right I will take it from here :-)
So the period is:
T = 2𝜋√LC
@KavinIshwaran OK :-)
09:24
Yes
@JohnRennie Will you be here till 5:30 PM IST ?
That was a hard one. Was that Mains or Advanced?
@JohnRennie Is is given under mains section
I'm here for another 3 to 4 hours but not after that as we have a big family dinner.
@KavinIshwaran I suppose the maths isn't hard, but it took me a while to figure out what was going on. It seems hard for Mains. Oh well.
09:26
Yeah...
@JohnRennie Will see you later :-)
Bye :-)
 
7 hours later…
16:08
Hello @KavinIshwaran
Do we consider only those lone pairs that are present on central atom
16:30
@HarjotDhillon Hi
@HarjotDhillon Yes
But suppose if you are considering diatomic molecules, lone pairs of both the atoms are considered
 
1 hour later…
17:42
@KavinIshwaran thanks, I accidentally marked C because I considered lone pairs of F also.
:-)
Lone pairs on other atoms can indeed affect the overall energy of molecule, but in JEE we don't consider it
In fact that is the reason F2 molecule has lowest bond dissociation energy

« first day (2499 days earlier)      last day (421 days later) »