Questions Tagged With #longcontesthttps://discuss.codechef.com/tags/#longcontest/?type=rssquestions tagged <span class="tag">#longcontest</span>enMon, 04 Mar 2019 18:59:23 +0530Huge fall in contest rating.https://discuss.codechef.com/questions/64032/huge-fall-in-contest-rating<p>My long contest rating fell suddenly from 1653 to -906 in JAN even though I attempted no questions in DEC or JAN. I was just wondering what caused this huge drop?</p>rishavbankaSun, 08 Feb 2015 15:34:41 +0530https://discuss.codechef.com/questions/64032/huge-fall-in-contest-rating#longcontest#ratingsAugust Challenge - SPELLBOB Whats wrong in my code?https://discuss.codechef.com/questions/133111/august-challenge-spellbob-whats-wrong-in-my-code<pre> #include "iostream"
#include "string.h"
using namespace std;
int main() {
string s1, s2;
int t;
cin >> t;
while(t--) {
cin >> s1 >> s2;
if(s1[0] == 'b' || s2[0] == 'b') {
if(s1[1] == 'b' || s2[1] == 'b') {
if(s1[2] == 'o' || s2[2] == 'o')
cout << "yes" << endl;
else
cout << "no" << endl;
}
else if(s1[1] == 'o' || s2[1] == 'o') {
if(s1[2] == 'b' || s2[2] == 'b')
cout << "yes" << endl;
else
cout << "no" << endl;
}
else
cout << "no" << endl;
}
else if(s1[0] == 'o' || s2[0] == 'o') {
if(s1[1] == 'b' || s2[1] == 'b') {
if(s1[2] == 'b' || s2[2] == 'b')
cout << "yes" << endl;
else
cout << "no" << endl;
}
else
cout << "no" << endl;
}
else
cout << "no" << endl;
}
return 0;
}
<code></code></pre>tommotakuMon, 06 Aug 2018 19:15:50 +0530https://discuss.codechef.com/questions/133111/august-challenge-spellbob-whats-wrong-in-my-code#longcontest#spellbob#cpp#augustWhy Segment Tree For CCIRCLES failed ?https://discuss.codechef.com/questions/137971/why-segment-tree-for-ccircles-failed<p>Here is the problem link
<a href="https://www.codechef.com/OCT18B/problems/CCIRCLES">https://www.codechef.com/OCT18B/problems/CCIRCLES</a>
My approach:
1)Pairwise calculate relative positions of all circles given .
2)Calculate min and Max dist between them.
3) Update the [min,max] range by incrementing it by 1.
4)For every query calculate answer in log(n) time.
Here's my solution link
<a href="https://www.codechef.com/viewsolution/21040808">https://www.codechef.com/viewsolution/21040808</a></p>
<p>Now,Let's analyze each step.
1)Since n=1000 pairs are of order n^2 that is 10^6.
2,3)Since max distance is also of order of n^2 Updating range with every pair costs O(n^2<em>log(n^2)) with lazy updates. So it takes 10^6</em> 20 steps ie 2*10^7.
4)Lastly, every query q is answered in (O(log(n^2)) time making it 20 * 10^5 steps.</p>
<p>Total Time = n^2 + n^2<em>2</em>log(n) + m * 2 log(n).</p>
<p>How did it fail the time limit ? Thanks in Advance!</p>shankaerSun, 21 Oct 2018 15:34:19 +0530https://discuss.codechef.com/questions/137971/why-segment-tree-for-ccircles-failed#longcontest#ccircles#codechef#segmenttree#33 Test case in MAXEP problemhttps://discuss.codechef.com/questions/141798/33-test-case-in-maxep-problem<p>MY all test case ran properly only in #33 (test case 33) it WA. Is there something wrong with my code or this is the case with everyone</p>desmond_kanekiSun, 09 Dec 2018 08:10:26 +0530https://discuss.codechef.com/questions/141798/33-test-case-in-maxep-problem#division2#longcontestNot able to understand test case of colorblind feasthttps://discuss.codechef.com/questions/142040/not-able-to-understand-test-case-of-colorblind-feast<p>I feel the answer of 2nd input should be 5 and last case of 1st input should be 2(this will be 3 if table is round).Please tell whether my understanding of question is wrong or anything else.
Thanks</p>bazzyadb123Thu, 13 Dec 2018 20:06:46 +0530https://discuss.codechef.com/questions/142040/not-able-to-understand-test-case-of-colorblind-feastchallenge#longcontestNo Input for weights is required in MATCHIThttps://discuss.codechef.com/questions/143522/no-input-for-weights-is-required-in-matchit<p>In challenge question MATCHIT, even without taking input for weights, it ran and give correct answer.
These types of things should be not there, as input format changes..</p>cherry0697Thu, 10 Jan 2019 12:38:58 +0530https://discuss.codechef.com/questions/143522/no-input-for-weights-is-required-in-matchit#longcontest#codechefPlease help me solve this problemhttps://discuss.codechef.com/questions/144852/please-help-me-solve-this-problem<p>Sorry, We can't.</p>xzayvianSun, 03 Feb 2019 09:23:53 +0530https://discuss.codechef.com/questions/144852/please-help-me-solve-this-problem#beginner#error#longcontest#codechef#newuserFEB19 HMAPPY2 Wrong Logic Gives AC (100/100) !!https://discuss.codechef.com/questions/145371/feb19-hmappy2-wrong-logic-gives-ac-100100<p>1.<a href="https://www.codechef.com/viewsolution/22717310">Wrong Logic Without LCM</a> Still 100/100 !!</p>
<p>2.<a href="https://www.codechef.com/viewsolution/22887931">Right Logic With LCM</a> 100/100 !!</p>
<p>This Solution contains wrong logic still it gives 100/100</p>
<p>This Solution only gives perfect answer when they give input A & B as the LCM(A,B) is A or B only.else it's wrong u can check that.</p>
<p>The Hidden test case files only contains that input in which LCM(A,B) is A or B.. so Test Cases are not considering all conditions..</p>
<p>Even The Example Test case is not in that test case file !! Because this solution gives wrong answer in that example test case also !!! still it gives AC(100/100) !!!!</p>mj_13Wed, 13 Feb 2019 21:47:48 +0530https://discuss.codechef.com/questions/145371/feb19-hmappy2-wrong-logic-gives-ac-100100feb19#insufficient-testcases#longcontesthmappy2error SIGEMT IN GIVEN CODE ..any suggestion ??https://discuss.codechef.com/questions/146273/error-sigemt-in-given-code-any-suggestion<h1>include<bits stdc++.h=""></h1>
<p>using namespace std;
int main()
{
long long n,c,b;
int t;
cin>>t;
for(int j=0;j<t;j++) {="" cin="">>n;
long long a[n];
c=0,b=0;
for(long long i=0;i<n;i++) {="" cin="">>a[i];
if(a[i]<0)
b++;
else
c++;
}
if(b)
{
if(b>=c)
cout<<b<<" "<<c;
else
cout<<c<<" "<<b;
}
else
{
if(b)
cout<<b<<" "<<b;
if(c)
cout<<c<<" "<<c;
}
}
return 0 ;
}</p>u__vMon, 04 Mar 2019 18:59:23 +0530https://discuss.codechef.com/questions/146273/error-sigemt-in-given-code-any-suggestion#longcontestmarch-challengeRank not awarded even after a month of my first contest.https://discuss.codechef.com/questions/54615/rank-not-awarded-even-after-a-month-of-my-first-contest<p>Hi,
This is with reference to user: <a href="http://www.codechef.com/users/psych3">http://www.codechef.com/users/psych3</a></p>
<p>I participated in my first long contest, OCT14, COOK51 and LTIME17 in Oct, 2014 i.e. last month. But I still have not been awarded my rank. It just displays that country code not found.</p>
<p>Anybody having any idea what is to be done to get my rank?
Thanks in advance.
Saim Raza</p>psych3Sun, 02 Nov 2014 10:17:44 +0530https://discuss.codechef.com/questions/54615/rank-not-awarded-even-after-a-month-of-my-first-contest#newuser#ltime17#rank#cook51#longcontest#codechef#oct14RED BLUE using Binary Searchhttps://discuss.codechef.com/questions/119351/red-blue-using-binary-search<p><strong>PREREQUISITES:</strong> Binary search, Line equations, slope finding</p>
<p>Okay so here is an editorial for <a href="https://www.codechef.com/DEC17/problems/REDBLUE">REDBLUE</a> using Binary Search. Yes you heard it right. Binary search is enough to solve the 7th problem. :) Lets start with the naive/brute force solution. Idea is pretty simple. Construct a line using a red and a blue point. The equation will be of form <strong>ax+by+c=0</strong>. Let us call this f(x,y). As you know given 2 points P1(x1,y1) and P2(x2,y2) you can find if they are in opposite side to the line by satisfying <strong>f(x1,y1)*f(x2,y2)<0</strong>. If product is >0 then they are on same side. So now we can loop over all red and blue points. Keep 2 counters cnt1=0 and cnt2=0. For a red point if f(x,y)<0 we increment cnt1 else cnt2. For blue point if f(x,y)<0 we increment cnt2 or cnt1. So for this line the minimum points to be deleted is min(cnt1,cnt2). We can do this for all lines that can be drawn for a given pair of red and blue points and find the minimum. <strong>Complexity=O(n^3)</strong></p>
<p><a href="https://www.codechef.com/viewsolution/16453057">Here</a> is my brute force code.</p>
<p>Lets try improving this a bit. First fix a blue point. Consider this as the <strong>origin</strong> of a shifted coordinate system. Now when you draw a line from this blue point to a red point it becomes a line passing through origin in the shifted system. So you can easily see that this line only cuts 2 quadrants whereas 2 other remain unaffected.
<img alt="Fig:1" src="https://discuss.codechef.com/upfiles/REDBLUE.jpg"></p>
<p>As you can see in the figure all the other lines having slopes less than p lie on one side and greater than p lie on other. This can be extended to all quadrants. So what we do is after fixing the blue point we loop over all red points and store their slopes w.r.t the selected blue point for all 4 quadrants. Then we do the same for all blue points except the selected one. Now sort all the slopes in all 4 quadrants. Now choose a red point say r in 1st quadrant. All red points to the right of the line which is formed by joining r with the selected origin(blue point) are:</p>
<ol>
<li>all red points in quadrant 2.</li>
<li>all red points having slope greater than r's slope in quadrant 1</li>
<li>all red points having slope less than r's slope in quadrant 2.</li>
</ol>
<p>2 and 3 can be found by using binary search in quadrant 1 and 3.
Similarly we can do the same to find all red points to the left of the line and blue points on either side.</p>
<p>This is to be done for all the red points in all quadrants.</p>
<p>So complexity is n<em>n</em>log(n). n for selecting a blue point and making it origin, then for each blue point choose a red point to form a line with which incurs a cost of n more and finally finding all points on either side of the line take log(n).</p>
<p>Hence complexity becomes: <strong>O(n^2*log(n))</strong>.</p>
<p><a href="https://www.codechef.com/viewsolution/16474526">Here</a> is my code for 100 points.</p>
<p>If you have any doubts feel free to leave a comment below. :)</p>soham1234Mon, 11 Dec 2017 16:31:49 +0530https://discuss.codechef.com/questions/119351/red-blue-using-binary-search#editorial#longcontest#redblueContest Timingshttps://discuss.codechef.com/questions/113873/contest-timings<p><a href="/users/1/admin">@admin</a>, there are 6 contest between 7-8 oct hosted by various colleges + October long challenge, the timing of some contest overlaps.</p>
<p>I request to change the contest timing so that maximum participation can be made.</p>eight_bitguyFri, 06 Oct 2017 11:58:40 +0530https://discuss.codechef.com/questions/113873/contest-timings#request#longcontest#admin#timing