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

Автор toilanvd_HSGS, история, 8 лет назад, По-английски

Hello everybody! Today I would like to introduce my first product: a "noughts and crosses" webgame (sorry if I disturbed you because this is not about algorithm :D ). Hope that it could make you relax with friends in the hot summer.

XO game is a game of 2 players, in which rules is very simple: make a row/column/diagonal of 5 consecutive X/O to win.

This is the instruction:

1, Go to website: http://www.xogame.vn.ae/

2, Click "Click here to login or signup"

3, If you signed up, you can your username and password to login. If not, click ">> I don't have an account! --> Sign up now" to sign up.

4, Enter your informations and click "Sign up" to register.

5, If you want to play with a user, click on that user's name in "online users" box. You will receive a notification. Then, if that user accept your invitation, you will be redirected to the game board:

6, When another user invite you to play, you can click "ok" to confirm, then you will be redirected to the game board.

7, In the game page, player's turn is defined by "(***turn***)" sign. X plays first.

8, You can see other people's games by clicking "this link" in chatbox.

9, There will be sound to notice you when some user invite you or when new messages arrive.

10*, Sometimes a username is displayed many time in "online users" box (because of server's bad condition), just click on one of these username to send invitation to that user.

11*, Sometimes your browser say "cannot connect to server" when you are playing or chatting, just wait for 3 seconds and reload the page again (a notification will appear to ask you to comeback to the game if you are playing any).

--> Done, enjoy the game :D

Because of limited conditions on the server, the game quality could be affected, I am really sorry about that!

Thank you very much for visiting my website!

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

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

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

Ok, I will go straight to the problem. Give N vertexes (N<=200000), build a graph by completing M (M<=200000) queries, each of them contain only one integer X (2<= X <= N), that means you must connect vertex 1 to vertex X, vertex 2 to vertex X+1, ..., and vertex N-X+1 to vertex N.

After built that graph, you have to list all connected components of that.

Thanks for your help!

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

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

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

I meet a hard problem with OR operation which I couldn't solve yet. However I think this one seem appeared in a round of Codeforces, I don't probably remember.

Given 2 strings with bit 0/1. String 1 has n bits, string 2 has m bits (n, m <= 10^5). There are at most 10000 queries, each contains 4 number a, b, c, d (condition is b-a=d-c). For each query, output one only number- numbers of bit 1 in the result when taking (segment [a,b] of string 1) OR (segment [c,d] of string 2).

Example:

n= 4, m= 5

String 1: 0011

String 2: 10101

Queries:

a= 2, b= 3, c= 1, d= 2 ----> answer is 2 because (01 | 10) = 11 which has 2 bit 1

a= 2, b= 4, c= 2, d= 4 ----> answer is 2 because (011 | 010) = 011 which has 2 bit 1

Thank you for reading!

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

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

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

Today I would like to introduce my 4 board games that I designed and hope that help you to relax!

You could download the source codes and run them in your computer to enjoy (they can't be run in Ideone because they have command "System("cls")")!

First, the simplest game which I saw in my dream last night: Source code

When you run this source code, an exe file will appear:

You could read the rules and after read, follow the instruction to play.

These are examples of playing games:

There will be 2 kind of input to enter:

  1. Choose team/bit: Enter 0 or 1

  2. Choose your piece/cell: Enter row number and then column number (1-based)

With a 4x4 board, this game can be solved with Dynamic Programming in O(2^16 * 16^2), but in my opinion playing without DP is more fun.

Second, based on that game, I designed 3 more games, and I think that they can't be solved using simple Dynamic Programming:

Game 1

Game 2

Game 3- easy version and Game 3- hard version

You can adjust size of the board by replace another value of n in source code. Because of lacking of time, I have just used random tools for Computer's AI. You can play these game with your friends to have other experience.

I merely know to create simple programmes like that, so sorry if you feel uncomfortable when playing.

Thanks for reading, and glad to listen to any response of you!

(Update: Added Game 3- hard version)

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

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

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

A have some problems with this, could somebody solve it? Thanks!

Give you a string S with N elements, each element is '(' or ')', and M queries, each query has form (x,y), you have to find maximum length of a correct bracket string in the substring from S[x] to S[y].

A sample test:

Input:

()()(()()(

2

1 7

7 10

Output:

4

2

(Limit: 1 <= N, M <= 200000)

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

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