Comments

The problem statement actually means that "Each character(i.e each element) of the whole string belongs to exactly one sub string."

Here characters at different indexes are considered different.

On ABalobanovContest in a gym, 5 years ago
+4

Are you getting correct answer for

4

1 2 2 3 ?

Using your approach you should get -1, but answer exists and is equal to 2 3 1 2

On ABalobanovContest in a gym, 5 years ago
+1

I found a test case where your solution might fail. What's your answer for 4 1 2 2 3?

On ABalobanovContest in a gym, 5 years ago
0

The editorial for C says 'Notice that order a[n/2], a1, a[n/2+1] ... is not always correct, see 112.' What is 112?

UPD: I think it is the test 3 1 1 2 ?

On hmehtaTopcoder Rookie SRM 2, 5 years ago
-6

hmehta Its been some time now. Has the eligible winners list announced(maybe in the forums)?

On hmehtaTopcoder Rookie SRM 2, 5 years ago
+3

Sorry, I thought this thread was of SRM 2 :)

On hmehtaTopcoder Rookie SRM 2, 5 years ago
+3

Has the list of winners announced?

+4

This outline makes complete sense. Such a short solution for such difficult problem! Beautiful

On MorphyCC Hello 2021 Long Challenge, 5 years ago
+5

"Ideally, if you want to report that some users have cheated, or if you want to appeal against having been caught for plagiarism, you should only send an email to help@codechef.com, and wait for a few weeks to get a reply." : admin

On MorphyCC Hello 2021 Long Challenge, 5 years ago
+8

How is commenting on the ALL the blogs of long challenge about cheating going to help? There are already many blogs posted about the YT channels/similar submissions/telegram groups and I am pretty sure the admins(CF and CC both) are looking for some means to stop that. But commenting again and again (and even tagging the admins) doesn't make the whole matter more irritating for the people who are actually creating these contests and maintaining these platforms for us?

I am a problemsetter for the problem WIPL of long challenge, and you know what makes me more sad than seeing the various videos of the solution? : seeing all the blogs literally saying "All the team's work went in vain".

I think making this contest, or rather any contest unrated is hardly going to make a difference. The Community needs something more promising than that.

For problem Div2 E, 99886275 is just so cool.

Why? The problems were pretty balanced, statements pretty clear

B and D should interchange their position :)

How would the solution change in Div2 D if it was also said to output the selected 2 substrings for which we are getting the best similarity? Any clues or suggestions are appreciated.

Maybe the hardest thing to encounter image

Can anyone check why this fails in one test case? https://atcoder.jp/contests/abc161/submissions/17260017

For problem E, should x always start from 0? or rather from 0 only when k is even and start from 1 when k is odd.

There are repetitions in your formula. For n = 4 the answer is 974. Check with your submission

This might help https://atcoder.jp/contests/abc178/submissions/16705345 I sorted the points considering points to be equal if they lie in the same circle centered at the origin

What was the approach for F?

I understand, I thought there's just 1 minute left which won't really make any difference. One cannot implement it that quick. Sorry though I should have been a bit more patient

Any ideas on how to do F? If the frequency of any number in first array is greater than n — (frequency of that element in the second array) than answer is "No" else answer exists.

I made a logic that the maximum frequent number in the first array will get the least frequent number from the second array. If there are multiple numbers with the same frequency then the smallest number with the smallest frequency goes to the largest number with the largest frequency. I was not quite able to implement it.

Aah, of course it is correct, got my mistake i use using INT_MIN instead of LONG_LONG_MIN ;-)

Is this approach correct? Sort the array then take i elements from front(i goes from [0, 5]) and take [n-4+i to n-1] elements from the back. Just compute the max ans from all i. I get WA on test 3, any clues anyone ?

+3

How can we solve E using DP?

That's what i think too. They have even used that in emaxx..

What's the use of if(dp[i][j]!=val) continue; I cannot see if anytime this condition will be true.

For E, try to imagine how the number of cuts is related to the maximum height of the chopped logs. If we have less k(suppose 0) then the answer will increase i.e the maximum height of the logs after chopping will be comparitively greater. If the number of cuts allowed is more(suppose 100000) then for a fix number of logs we can cut them more times than when cuts was 0, hence the maximum optimised length of any log will be less. Thus more the number of cuts, lesser will be the maximum length, when chopped optimally. Now, can you apply BS here? Sure you can :)

Intitially i thought there must be some pattern, but after struggling for some time solved it using school mathematics. Important observations, 1) if n is even answer is always -1 2) answer cannot exceed the number itself. Check out my solution https://atcoder.jp/contests/abc174/submissions/15619615

gupta_samarth I just went through your solution for E, phi[i] gives the count of numbers from 1 to i which are coprime with i. now = expo( k/g, n ) means inserting all the multiples of g in the array of size n . What I don't understand is that why did you do phi[g]*now ?

May be there approach was different , which does not directly depend on parity of elements.. maybe

The contest has been declared unrated due to some invalid inputs for problem D :(

This might help a bit.

On jaigurudevEuler totient theorem, 7 years ago
0

Absolutely right ,Fermat's theorem is a special case of euler's but are there problems where direct application of euler's theorem is required.i.e we need to some how use the number of conprimes less than n. Thanks in advance.

On jaigurudevEuler totient theorem, 7 years ago
-8

That's application of Fermat's little theorem, not euler.

If p divides q your answer returns n/p which is not correct as if l =1 r= 10 p=3 q= 6 . The answer will be 2 not 3. Your solution here gives all f(x,p) >= f(x,q) but we need f(x,p) > f(x,q). This can be removed by removing this case.

Regarding Marcin and Training Camp . It is written that if any student has a set of skill strictly less than the skills of everyone in any group then he can be safely included.

Consider this example in which the group consists of skills 4(100) and 4(100) ,now including 1(001) will make him think himself better than others because no one else in the group has first bit set. Am i missing something ??

Thanks for your efforts Geothermal this is true contribution.

On surajkvm007balanced parenthesis, 7 years ago
0

We can do this , lets define the level of any "()" to be the number of opening brackets under which it appears so just count number of "()" and for every "()" also add in the answer the number of balanced substrings appearing in that level .

#/*
	AUTHOR:shivam51
	IIESTS
*/
  #include<bits/stdc++.h>
  using namespace std;
  //
  #define add accumulate
  #define ll long long int
  #define rep(i,k,n) for(int i=k;i<n;i++)
  //
  //
	void solve(){
		string str;
		cin>>str;
		ll cnt=0;
		vector<char> vec;
		vll arr(str.length()/2+1,0);
		int pre=0;
		rep(i,0,str.length()){
			if(str[i]=='('){
				++pre;
				vec.pb('(');
			}
			else{
				++cnt;
				vec.pop_back();
				cnt+=arr[pre];
				arr[pre]++;
				--pre;
			}
		}
		cout<<cnt;
	}
  int main(){ 
	hs;
	ll t;
	// cin>>t;
	t=1;
	while(t--)
	    solve();
	return 0; 
} 
On heath_cliffTopcoder submissions, 7 years ago
0

Auto comment: topic has been updated by heath_cliff (previous revision, new revision, compare).