What are the steps to be taken to become a good TopCoder?

0

Answer by Nick Wu:

1) Practice.
2) Do step 1.

Of course, that’s what everyone tells you, so let’s try to be a little more useful here.

1) Identify your current skill level.

You can do this in a variety of ways. The easiest way is to do a few SRMs and get a rough idea of what your rating is, and consequently, what problems you should work on. Use your performance in a few contests or solve a few problems in practice to see where you are.

2) Start pushing your boundaries.

I’ll give some rough information on what problems you should be working on given your color rating (these aren’t hard rules, but I believe they’re reasonable things to try.)

  • Grey: Be more consistent on solving div2 easy problems.
  • Green: Get faster at solving div2 easy problems, start building consistency on div2 medium problems.
  • Blue: Build consistency on div1 easy problems.
  • Low yellow (Below ~2000): Start building speed on div1 easy problems.
  • High yellow (Above ~2000): Start working on solving div1 medium problems.
  • Red: Start building speed in div1 medium problems.

The hard problems are designed to be solved by very few people so I don’t include them in my list. Yellow coders may be able to use div2 hard problems as a substitute, but you should be able to get by with just div1 medium problems.

3) Repeat steps 1 and 2.

You’ll constantly be improving, so you should work on problems that keep you interested. If you’re a blue coder, there’s not too much point to working on div2 easy problems since you will never actually do one in a regular SRM. Instead, working on building consistency in div1 easy problems, although more difficult, will be more worthwhile. Re-evaluate your skill level every so often (this will be done implicitly if you do more SRMs) and calibrate your training to match.

What are the steps to be taken to become a good TopCoder?

Topcoder SRM 646 Div 2 TheGridDivTwo

0

Link – http://community.topcoder.com/stat?c=problem_statement&pm=13628&rd=16278

Well, this is a simple graph problem once you get the logic !

A simple BFS traversal is enough to find the maximum x coordinate value.

A visited array is maintained to log the coordinates that are visited (inorder to avoid visiting the same point again)

First of all since John can move in any directions , he can end up in in negative coordinates also. So to represent negative coordinates as array index move origin(0,0) to (1000,1000).(transformation of coordinates. x=x+1000, y=y+1000)

On each traversal compare the x coordinate with current ans and updated it if x Value>ans

On returning the maximum x coordinate dont forget to decrement it with 1000 (inverse transformation of coordinates)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
class TheGridDivTwo {
public:
typedef struct point{
int x;
int y;
int k;
}point;
int valid(int x,int y){
return (x>=0)&&(y>=0)&&(x<=2002)&&(y<=2002);
}
int find(vector <int> x, vector <int> y, int k) {
int visited[2002][2002];
queue<point>q;
memset(visited,0,sizeof visited);
point origin;
origin.x=1000;
origin.y=1000;
origin.k=k;
q.push(origin);
visited[1000][1000]=1;
for(int i=0;i<x.size();i++){
visited[1000+x[i]][1000+y[i]]=1;
}
int ans=1000;
while(!q.empty()){
point temp=q.front();
point temp1;
q.pop();
if(temp.k<=0)
continue;
if(valid(temp.x+1,temp.y)&&(!visited[temp.x+1][temp.y])){
visited[temp.x+1][temp.y]=1;
ans=max(ans,temp.x+1);
temp1.x=temp.x+1;
temp1.y=temp.y;
temp1.k=temp.k-1;
q.push(temp1);
}
if(valid(temp.x-1,temp.y)&&(!visited[temp.x-1][temp.y])){
visited[temp.x-1][temp.y]=1;
temp1.x=temp.x-1;
temp1.y=temp.y;
temp1.k=temp.k-1;
q.push(temp1);
}
if(valid(temp.x,temp.y+1)&&(!visited[temp.x][temp.y+1])){
visited[temp.x][temp.y+1]=1;
temp1.x=temp.x;
temp1.y=temp.y+1;
temp1.k=temp.k-1;
q.push(temp1);
}
if(valid(temp.x,temp.y-1)&&(!visited[temp.x][temp.y-1])){
visited[temp.x][temp.y-1]=1;
temp1.x=temp.x;
temp1.y=temp.y-1;
temp1.k=temp.k-1;
q.push(temp1);
}
}
return ans-1000;
}
};
<%:testing-code%>
//Powered by KawigiEdit 2.1.4 (beta) modified by pivanof!

SRM 403 DIV 1 TheLuckyNumbers

0

Problem Statement

John thinks 4 and 7 are lucky digits, and all other digits are not lucky. A lucky number is a number that contains only lucky digits in decimal notation.
You are given ints a and b. Return the number of lucky numbers between a and b, inclusive.
Definition

Class:
TheLuckyNumbers
Method:
count
Parameters:
int, int
Returns:
int
Method signature:
int count(int a, int b)
(be sure your method is public)
Constraints

a will be between 1 and 1,000,000,000, inclusive.

b will be between a and 1,000,000,000, inclusive.
Examples
0)
1
10
Returns: 2
There are only two lucky numbers among the first ten positive integers.
1)
11
20
Returns: 0
But there are none among the next ten.
2)
74
77
Returns: 2
These two numbers are lucky. There are no additional lucky numbers between them.
3)
1000000
5000000
Returns: 64

[gist https://gist.github.com/vishnujayvel/8e3bda4262baf02e1311]