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

Автор HaiZuka, история, 4 года назад, По-английски

Today is a special day for Vietnamese, this is the last day of 2021, tomorrow is the first day of the Vietnamese New Year.

Tet, or Lunar New Year is viewed as one of the most popular festival in Vietnam. It is celebrated on the same day as Chinese New Year, taking place from the first day of the first month of the Vietnamese calendar (around late January or early February) until at least the third day. Tet is a special occasion for people gather around their family, express their respect to their ancestors and welcome a happy new year. Tet occupies an important role in Vietnamese culture, so are the preparation for the special days and the customs people always carry out in Tet.

 The preparation for Tet often begins before one or two weeks. First, people frequently spend a few days cleaning their houses, polishing furnishings and bronze incense burner, or even repainting the walls. They want everything in the houses must be clean and clear to get good lucks in New Year and get rid of bad ones in the old year. Moreover, houses are garnished with colorful lights and parallel sentences. Besides, many Vietnamese prepare for Tet by cooking special holiday foods, such as square rice cake, dried young bamboo soup and pickle. Furthermore, they also buy other kinds of food like cakes, candies, jam. These are extremely delicious and contain culinary culture in Vietnam.

In addition to the busy preparation for Lunar New Year, these very first days of the year are occasions to everyone to have relax and rest time after a hard-working and occupied schedule year. Hence there are many interesting activities happen in Tet. For instance, in some big cities, people organize concerts and performance firework at the countdown moment of the New Year’s Eve to welcome a Happy New Year. On the other hand, there is something that must be avoided on these days. For example, sweeping during Tet is taboo and considered to be unlucky since it symbolizes sweeping away the good lucks. This is the reason why they always clean the house before the New Year. It is also taboo for anyone who experienced a recent loss of a family member to visit anyone else’s house during Tet.

Tet is a special and meaningful occasion to all Vietnamese. It is the time for people reunite with their family after a long time not seeing each other and take a rest after a hard-working year. To every Vietnamese, Lunar New Year is always a tradition that no one can break down, and they will do everything to protect and develop it.

I hope that everyone will have a lot of luck in the new year.

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

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

Автор HaiZuka, история, 4 года назад, По-английски

Hello codeforces. Today I have a very interesting exercise, which is a number sorting game. First of all, let's understand this game.

The interface will consist of a rectangle of m rows and n columns, containing m * n squares of size 1*1. The squares will get a value from 1 to m*n-1 where no 2 cells have the same value, and 1 empty cell is numbered -1. For each step, the player is allowed to change the position of the empty cell (_containing the number -1_) for the adjacent cells. The game will be over if the tiles are in place, an empty cell (bearing number -1) is at the bottom right corner, the remaining numbers are arranged in ascending order from left to right, top to bottom. The figure below is an example of the ending game:

Given before starting game state check if you can end the game, output "YES" if possible, otherwise return "NO".

Input

  • The first is two integers m and n, which are the dimensions of the matrix. (**1 < m, n < 10000**)
  • Next is the values of the elements in the matrix.

Output

Returns "YES" if it can be sorted to end state, otherwise "NO".

Examples

_______________________________________________________________________

Input:
2 3
1 5 2
4 3 -1
Output:
YES

The game can be over, the bottom one is to end the game.

_______________________________________________________________________

Input:
2 2
1 3
2 -1
Output:
NO

There is no way to end a game with such a start.

______________________________________________________________________

Input:
3 3
2 7 1
4 6 3
5 -1 8
Output:
NO

_______________________________________________________________________

Let's do it with me, I'll soon create this exercise with a complete test set.

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

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

Автор HaiZuka, история, 4 года назад, По-английски

1234F - Yet Another Substring Reverse

Hello my friends.

I am having trouble with the problem 1234F - Yet Another Substring Reverse.

It seems my approach is not optimal so my program can only be accepted with small trials. I also consulted my friends but to no avail. Can you come up with a way to solve this problem?

Thank you very much.

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

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

Автор HaiZuka, история, 4 года назад, По-английски

Hello everyone.

I recently entered the contest Codeforces Round 699 (Div. 2), specifically I did the exercise 1481A - Space Navigation , which asked me to read two integers qx, qy and finally a string character S. I use C ++ programming language to do this. I used the fflush(stdin) function to clear the count memory while doing this, specifically my main code at the time was:

vector <string> ans;

int main() {
    int t, a, b;
    string s;
    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> a >> b;
        fflush(stdin);
        getline(cin, s);
        ans.push_back(solve(a, b, s));
    }
    for (int i = 0; i < ans.size(); i++)
        cout << ans[i] << endl;
}

The problem I have is that the codeforces system does not seem to be executing my fflush () function, while I am still able to run the correct program using my computer.

I have to fix my program to:

vector <string> ans;

int main() {
    int t, a, b;
    string s;
    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> a >> b;
        cin >> s;
        ans.push_back(solve(a, b, s));
    }
    for (int i = 0; i < ans.size(); i++)
        cout << ans[i] << endl;
}

With this program, the system accepted my program.

However, entering a string using the function std :: cin is not a good choice, if there is ' '(whitespace, # 32 ASCII) in the string then I don't really know how to read the data. :(

I write this article to ask you to share your experiences about the problem that I am facing to help my upcoming competitions go smoother.

Thank you for reading my article, good day.

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

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

Автор HaiZuka, история, 4 года назад, По-английски

Hello friends I just joined the codeforces system not long ago, I have some eye problems so I haven't done the exercises on a white background for a long time, I want to know if the codeforces system has dark mode, if so, what do I do to switch to that mode. Thanks very much.

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

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