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

Автор tbquan08hanoi, история, 3 месяца назад, По-английски

Hello codeforces!

I have a problem: counting primes in $$$[m, n)$$$ where $$$1<=m<n<=2 \cdot 10^9$$$.

Because the range could be large, I can't use sieve because of the memory complexity or normal primality test in $$$O(sqrt(n))$$$

Thanks very much!

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

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

Автор tbquan08hanoi, 3 месяца назад, По-английски

Problem: A pile has $$$n$$$ stones and 2 players: Player A go first. Each move, the player will take $$$k$$$ stones from the pile, where $$$k$$$ is a prime number. Whoever can't make a move first is lost. Problem has multiple test. Constraints: $$$1 <= t <= 100$$$: Number of tests $$$2 <= n <= 3 \cdot 10^6$$$: The number of stones in the pile Output: A if A wins, B if B wins.

(Idk if it is a nim problem or not, that's the reason of the question mark) (Also, when I do $$$O((n)^2)$$$, I do precalculation: $$$res[0]=res[1]=0$$$(base case), $$$res[i]=1$$$ only if exist a prime $$$p$$$ where $$$res[i-p]=0$$$, else $$$res[i]=0$$$)

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

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

Автор tbquan08hanoi, история, 3 месяца назад, По-английски

I read some posts from "Recent Actions" about cheaters from some latest contest, and I have a question: How did you guys find those cheaters, because I don't think reading all solutions is a great way to find them :skull_emoji:

And how you know a participant copy code from a different participant, I have read some blogs and I still can't find out why you guys know.

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

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

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

I don't understand this error, can anyone help me

In file included from C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/string:43, from C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/bitset:52, from C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/x86_64-w64-mingw32/bits/stdc++.h:52, from program.cpp:44: C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/bits/allocator.h: In destructor 'constexpr std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int> > >::_Vector_impl::()': C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'constexpr std::allocator< >::allocator() noexcept [with _Tp = std::pair<int, int>]': target specific option mismatch 184 | allocator() _GLIBCXX_NOTHROW { } | ^ In file included from C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/vector:66, from C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/functional:64, from C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/x86_64-w64-mingw32/bits/stdc++.h:53: C:/Programs/gcc13-64-winlibs/include/c++/13.2.0/bits/stl_vector.h:133:14: note: called from here 133 | struct _Vector_impl | ^~~~~~~~~~~~

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

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

Автор tbquan08hanoi, история, 5 месяцев назад, По-английски

I have heard about segment trees that can handle delete queries by processing the queries offline and creating a segment tree over the timeline of the queries. Does anyone know about this? (It could be persistent segment tree, but i'm not sure. If the structure above does not exist, please tell me.)

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

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

Автор tbquan08hanoi, история, 5 месяцев назад, По-английски

Is there a way to check whether an integer is a prime or not in O(log(n))?

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

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

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

Hi Codeforces community!

I was doing a problem like this: Given a string s, reverse a substring of it in each query, and print the final string after all queries. Constraints are 1 ≤ |S|, Q ≤ 10^5. I have seen many solutions using tree algorithms, is it possible to solve this problem without using tree algorithms?

Thanks!

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

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