### pkpawan's blog

By pkpawan, history, 2 years ago,
• -4

By pkpawan, history, 3 years ago,

During contest I really get nervous and I lost my concentration and the two main reasons which I find for that are :-
1. Getting WA on solution I submit
2. Seeing the leaderboad with thousands of submission and I am not able to figure out the solution of that question

• The following reasons lead to silly mistakes or mistakes which you generally don't do ( i.e. missing the constraints of question etc)

• In the last contest #Codeforces round 694 Div 2 due to silly mistakes I got wrong answer on Problem A ( System test Failed ) and WA on Problem B.

Here are my solution with WA and AC :-
1. Problem A which failed system test ( https://codeforces.com/contest/1471/submission/103419176 )
2. Problem A which got AC ( https://codeforces.com/contest/1471/submission/103465431 )

• The mistake I did here is I forgot the constrains of 'x'
1. Problem B which got WA ( https://codeforces.com/contest/1471/submission/103431767 )
2. Problem B which got AC ( https://codeforces.com/contest/1471/submission/103464987 )
• This is one the most silly mistake that I did in the following condition ( if( P[i].first % x) ) is I use '2' in place of 'x' as , in hurry I considered the sample case with x=2 ( I don't know how can I do so ).

• Comedy part is I just solved problem C too which I was not able to come up with solution during contest .

I want suggestions on How to tackle these problems of anxiety and be more focused and concentrated during contest ??

• +47

By pkpawan, history, 4 years ago,

I am confused ,which path should I follow out of these :-

1. should I practise question based on algorithms like I should search for particular type of algorithm and do lots of question of it after learning the algorithm from :-https://codeforces.com/problemset or https://cp-algorithms.com/ .

2. should I practise question based on difficulty from :- https://www.a2oj.com/Ladders.html and learn algorithm which come on my way of solving question .

I loved the first way but the problem is there are lot of algorithms and in which sequence should I learn them I don't know .please help.

• -2

By pkpawan, history, 4 years ago,

Here is the question :-https://codeforces.com/contest/1270/problem/B

what i understood from the question that we need to find subarrays such that the difference of maximum and minimun element is equal to N (total emenets of array ) ,if it is not possible print "NO" else print "YES" and in next line print 1 and 'ending index' but if we are given an array 'A' and it is statifying condition max(A)-max(B)>=N then according to question answer should be 'YES' 1 N(size of array)

which we even need to check for subarray ?that's all I understood from question please help me out in understanding correctly

here's my code:- 

# include<bits/stdc++.h>

using namespace std;

int main() { int t; cin>>t; while(t--) { int n,f=0; cin>>n;

int A[n],i,j,min=0,max=0,l,r;
for(i=0;i<n;++i)
{
cin>>A[i];
if(max<A[i])
{
max=A[i];         //finding max
}

}
min=A[0];
for(i=1;i<n;++i)
{
if(min>A[i])
{
min=A[i];               //finding min
}
}

if(max-min>=n)                   //checking condition max(A)-min(A)=n
{
for(i=0;i<n;++i)
{
if(A[i]==min)            //checking at what index is min and max present
{
l=i+1;                  //adding 1 in index as index taken from 0 to n-1
}
if(A[i]==max)
{
r=i+1;
}
}
if(l<r)                           //checking which is greater and printing accordingly
{
cout<<"YES"<<endl;
cout<<l<<" "<<r<<endl;
}
else
{
cout<<"YES"<<endl;
cout<<r<<" "<<l<<endl;
}

}
else
{
cout<<"NO"<<endl;
}

}

return 0;

}

• 0