Away_in_the_heavens's blog

By Away_in_the_heavens, 3 months ago, In English

Hello, Codeforces!

Massive update + Firefox Addon

This is my first browser extension, and I made it to solve a small annoyance I often have while reading C++ submissions: too many macros, especially short aliases for loops and common operations.

Chrome Web Store: install Codeforces Un-definer

Firefox Add-ons: install Codeforces Un-definer for Firefox

GitHub: source code

Codeforces Un-definer adds small intuitive interface buttons near #define, typedef, and simple using alias lines. When you click one, the declaration is crossed out and its usages are rewritten inline in the code. This way, you can easily turn macros and aliases on and off while reading.

For example, here is a comparison image:

Codeforces Un-definer example

Massive update

The extension has received a large update based on feedback.

What changed: - Added support for AtCoder, QOJ, OJUZ, and CodeChef submission pages.

  • Added a popup menu to enable or disable the extension per supported site.

  • Added support for simple typedef aliases.

  • Added support for simple using aliases.

  • Added support for template using aliases, for example template<class T> using V = vector<T>;

  • Improved support for nested aliases, for example using vi = V<int>;

  • Added best-effort support for multiline #define macros.

  • Added best-effort support for variadic macros using __VA_ARGS__

  • Improved button placement and scrolling behavior in Ace-based code viewers.

  • Improved changed-line highlighting and color preservation.

  • Added a Firefox version.

  • The extension now ignores submit/custom-test/compiler pages where it should not run.

The current expansion logic is still lightweight. It works well for many common competitive programming macros and aliases, but it is not a full C++ preprocessor. Very complex macros, unusual formatting, and advanced template tricks may still fail or produce confusing text.

If you find a common case where it fails, or if you have any suggestions, feel free to report it on GitHub Issues or write it in the comments:

GitHub Issues

I plan to keep updating it if I receive useful feedback or suggestions.

Chrome Web Store: install Codeforces Un-definer

Firefox Add-ons: install Codeforces Un-definer for Firefox

Full text and comments »

  • Vote: I like it
  • +97
  • Vote: I do not like it

By Away_in_the_heavens, history, 4 years ago, In English

Problem statement: The Sultan had a permutation of numbers from 1 to N. For interest, he put inequality signs ">" and "<" between adjacent permutation numbers. For example, if the permutation was [1, 3, 2, 5, 4], then it would be [1<3>2<5>4]. He got tired of playing with his swap and went to make himself a mango smoothie. While the Sultan was preparing a smoothie, his cat entered the room and erased all the numbers, but the inequality signs remained. Now the Sultan is interested in how many permutations exist that satisfy these inequalities. Since there can be many ways, he asked you to help him and give an answer modulo 998244353. __

A permutation of numbers of length N is an array of N integers, where each number from 1 to N occurs exactly 1 time. For example, [1 2 3] and [4 2 1 3] are permutations, but [1 2 2] and [1 2 3 5] are not. __

Input The first line contains an integer N — the length of the permutation. The second line contains a string of N-1 characters "<" or ">".

Output Print the number of permutations modulo 998244353.

So there some subtasks

n<=10 — 10 points

n<=20 — 10 points

n<=500 — 30 points

n<=2000 — 60 points

Examples:

Input

5

<><<

Output

9

Input

3

<>

Output

2

I already have idea for first subtask using n! solution

Full text and comments »