Блог пользователя Tensor

Автор Tensor, 9 лет назад, По-английски

This is my profile on Typeracer, i've completed 1980 race :D but still not that fast typist. if you already have a profile or sign up and take a race then share your profile or speed, just for having some fun :-)

good luck and have some fun

Полный текст и комментарии »

  • Проголосовать: нравится
  • +24
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

Is this an incoming seven days contest or it's just a mistake ?!!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

This is somehow far from competitive programming but recently I'm trying to get enrolled in a summer of code project with boost library ( an open source C++ library ), to get enrolled in the boost summer of code projects requires a competency test, mine was writing a simple C++11 vector-like class.

I've written an std::vector like class but not with all methods like that of the STL (it's not required to fully complete the class), so it would be appreciated to give any feedback about my code and tell me if any issues are found.

Thanks in advance :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

I have been solving this problem, but i don't know what is wrong with my submission.

#include <unordered_map>
#include <cstring>
#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 <cassert>
#include <unordered_set>

using namespace std;

const int N = 101, inf = 1e9;

char a[N], b[N];

int f[N][N][N], n, m;

int dp(int i, int j, int k, int val) {
  if (i < 0 || j < 0)
    return -inf;
  if (k == 0)
    return val;
  int &ret = f[i][j][k];
  if (ret + 1)
    return ret;
  ret = 0;
  if (a[i] == b[j])
    ret = max(ret, dp(i - 1, j - 1, k - 1, val + a[i]));
  else {
    ret = max(ret, dp(i - 1, j, k, val));
    ret = max(ret, dp(i, j - 1, k, val));
  }
  return ret;
}

int main(void) {
#ifdef DEBUG  
  freopen("in.txt", "r", stdin);
//  freopen("o.txt", 'w', stdout);
#endif
  int tc, k;
  for (scanf("%d", &tc); tc--; ) {
    scanf("%s %s %d", a, b, &k);
    n = (int)strlen(a), m = (int)strlen(b);
    memset(f, -1, sizeof(f));
    printf("%d\n", dp(n - 1, m - 1, k, 0));
  }
  return 0;
}

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

currently i'm trying to change gedit settings in order to be more capable of compiling, running, automatically inserting templates... etc. the problem is i don't know how to change the settings i searched the web and find zillions of answers but still can't configure the settings!

any help would be pleased :)

thanks in advance :-)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

trying to increase the stack size while running c++ code from terminal, i tried google and get gcc -Wl,--stack,200000000 and also g++ -Wl,--stack,200000000 i tried to write these through the terminal but i get something like cannot find and error and fatal error, any help please!

thanks in advance

UP solved

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

while solving a certain problem in c++, I tried to see the execution time on my pc.

Running the program on the terminal and mingwG++ gives time 0.14, while running it through visual studio it gives me 3.874!!!!!

please can anyone explain me this phenomenon, why there is such a great difference between both executions ?!

thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

please can anyone explain to me why we use combinations in such problems like problem D ?!

thanks in advance and happy new year :-)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

may be some of you know how to collect all contests in one calender, i've found this site with this calender, just click on +google calender in the bottom right of the calender in the site and it's all yours and will be synchronized automatically with all contest from codeforces, hackerrank, topcoder, timus, codechef and googlejam i think.

happy coding!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

I do believe in books and practicing alot depending on my own, that's how i started tell now. But it turns that books, practicing alot and a coach the three together is the fastest method to do better quickly.

I need a coach to train me and give me that advices that would make me better and better and grow faster in competitive programming. Is there anyone willing to help me ?

thanks in advance..

UP: fortunately i had found one :-)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

I'm new to dynamic programming, I had been reading this book but don't know if it a good resource for learning dynamic programming approaches, so if any one had any book (not a tutorial 'please') on dynamic programming please tell me..

thanks in advance!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

I had been solving this problem

this is my code so far ... any help would be appreciated.

thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски
  • have been trying this problem but in vain .

here is my code so far. I have considered the graph as DAG.

any help plese. thanks in advance

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Tensor, 9 лет назад, По-английски

I'm solving this problem but there is a little problem for first test case my solution on visual studio returns (2 6) the right answer. after submitting i get wrong answer on test case 1!! getting (1 6) either than (2 6). here is my code please can any one tell me what's the problem?!! thanks in advance!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

Автор Tensor, 10 лет назад, По-английски
  • This is just a method i used to make me able to include bits/stdc++.h
  • in visual c++.
  • for those had minGW installed on PC :
  • C:\MinGW\mingw32\lib\gcc\mingw32\4.8.1\include\c++\mingw32\bits
  • copy this folder and then go to this adress
  • C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
  • paste your folder. go to your visual studio project type bits you will see
  • the auto-complete for the library and then choose stdc++.h
  • for those don't have minGW:
  • you should write your own header file and include all libraries in it then
  • go to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
  • make new folder name it "bits" and name the header file stdc++.h
  • then paste it in "bits" folder.
  • Hope this helps!
  • Happy coding

Полный текст и комментарии »

  • Проголосовать: нравится
  • +28
  • Проголосовать: не нравится

Автор Tensor, 10 лет назад, По-английски

any one can help me with this Problem from spoj. I have tried zillions time. once I used 3D bfs getting wrong answer then using 2D bfs getting between wrong answer and time limit.

2D bfs 3D bfs

thanks in advance!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится