Git Product home page Git Product logo

Comments (13)

maspypy avatar maspypy commented on September 10, 2024 1

I would like to propose assigning invertible (2,2) matrices to vertices and edges.

Finding the inverse of all matrices can be done in $O(\log mod + N)$ time, and since the computational complexity can also be measured by the unionfind problem, I think we don't need to worry about the execution time for finding inverses.

On the other hand, in competitive programming problems, I think groups are often commutative groups or sets of affine transformations in the form of $\pm x + a$, so it may be appropriate to include conventional addition problems as originally proposed.

Furthermore, even if there are problems similar to those on AOJ, it would be fine to place useful problems all in the Library Checker.

from library-checker-problems.

maspypy avatar maspypy commented on September 10, 2024 1

How about
Unionfind with Potential
Unionfind with Potential (non-commutative group)

from library-checker-problems.

maspypy avatar maspypy commented on September 10, 2024

Thank you!
Since this data structure can handle groups (not limited to commutative groups), I want to deal with non-commutative groups.
Here are some examples of the types of problems we can consider:

Each vertex has values $(x[0], \ldots, x[N-1])$. These values are unknown.

[Query 1]
Given $(u, v, a, b)$, where $a \neq 0$.
This means the information $x[v] = a x[u] + b \pmod{998244353}$.
This information is valid if it does not contradict any previously valid information.
Output whether this information is valid or invalid.

[Query 2]
Given (u, v, x). Based on the previously valid information and assuming x[u] = x, determine x[v] or print -1 if it can't be determined.

from library-checker-problems.

Misuki743 avatar Misuki743 commented on September 10, 2024

Seems nice, but to compute the inverse of affine would require computation of modulo inverse, which would make the time complexity increase from $O(q \alpha(n))$ to $O(q (\alpha(n) + \lg \text{mod}))$, maybe it's better to find a way to avoid extra cost not from the data structure itself? For example, change to another non-commutative group whose inverse won't be that costly, or just gives affine and its inverse in the input?

from library-checker-problems.

lrvideckis avatar lrvideckis commented on September 10, 2024

this problem already exists here https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_B if you want to test your library on it

from library-checker-problems.

maspypy avatar maspypy commented on September 10, 2024

The problem I proposed was flawed. The fact that a cycle was formed where the composition is not the identity map only determines the values at the vertices of the cycle and does not necessarily indicate a contradiction.
It might be better to associate the group elements directly with the vertices. A (2,2) matrix might be easier for the general user to understand than an affine transformation.

from library-checker-problems.

Misuki743 avatar Misuki743 commented on September 10, 2024

So if I understand correctly, entry of matrix on vertices would be some variable while entry of matrix on edges would be some constant?

from library-checker-problems.

maspypy avatar maspypy commented on September 10, 2024

Yes

from library-checker-problems.

maspypy avatar maspypy commented on September 10, 2024

Problem 1

未知の整数列 $(a_0, \ldots, a_{n-1})$ がある.$Q$ クエリを処理せよ.

0 u v x:列 $a$ に関して $a[u]=a[v]+x$ であるという情報が与えられる.
この情報が valid であるとは,これまでの valid な情報に矛盾しないことを意味する.
この情報が valid であるか否かを出力せよ.

1 u v:これまでの valid な情報をもとに $a[u]-a[v]$ が定まるならばその値,定まらないならば -1 を出力せよ.

Problem 2

$2\times 2$ 可逆行列からなる未知の列 $(a_0, \ldots, a_{n-1})$ がある.$Q$ クエリを処理せよ.

0 u v x_{00} x_{01} x_{10} x_{11}:列 $a$ に関して $a[u]=a[v]x$ であるという情報が与えられる.
この情報が valid であるとは,これまでの valid な情報に矛盾しないことを意味する.
この情報が valid であるか否かを出力せよ.

1 u v:これまでの valid な情報をもとに $a[x]^{-1}a[u]$ が定まるならばその値,定まらないならば -1 を出力せよ.


Problem 1

There is an unknown sequence of integers $(a_0, \ldots, a_{n-1})$, process $Q$ queries.

0 u v x: You are provided with information that $a[u]=a[v]+x$. Determine if this information is valid, meaning it does not contradict any previously given valid information. Output whether this information is valid or not.

1 u v: Based on the valid information provided so far, output the value of $a[u]-a[v]$ if it can be determined; otherwise, output -1.

Problem 2

There is an unknown sequence of $2\times 2$ invertible matrices $(a_0, \ldots, a_{n-1})$, process $Q$ queries.

0 u v x_{00} x_{01} x_{10} x_{11}: You are provided with information that $a[u]=a[v]x$, where $x$ is a $2\times 2$ matrix with elements $x_{00}, x_{01}, x_{10}, x_{11}$. Determine if this information is valid, meaning it does not contradict any previously given valid information. Output whether this information is valid or not.

1 u v: Based on the valid information provided so far, output the value of $a[v]^{-1}a[u]$ if it can be determined; otherwise, output -1.

from library-checker-problems.

Misuki743 avatar Misuki743 commented on September 10, 2024

I think I can prepare them

from library-checker-problems.

maspypy avatar maspypy commented on September 10, 2024

Thank you, and I appreciate your help. If you have any questions about the preparations, please feel free to ask.

from library-checker-problems.

Misuki743 avatar Misuki743 commented on September 10, 2024

how should we naming these two problem? I was thinking using

  • Unionfind with Potential (commutative group)
  • Unionfind with Potential (non-commutative group)

or maybe specify which group are used in (...)? In such case, what should it be? (I'm not very familiar with abstract algebra)

from library-checker-problems.

maspypy avatar maspypy commented on September 10, 2024

If you want to avoid calculating the inverse, you can include the constraint $x_{00} x_{11} - x_{01} x_{10} \equiv 1 \pmod{998244353}$.

from library-checker-problems.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.