D. Different vectors

Codeforces
IDCF10020D
Time1000ms
Memory64MB
Difficulty
English · Original
Formal · Original
You are given a set of N vectors, each vector consists of K integers. Vector X is equivalent to Y (denoted X ≡ Y) iff there exist a bijection and an integer r, such that for each i in the range [0..K - 1]. For example, (1, 2, 2, 3) ≡ (22, 3, 4, 22), with r = 2 and f(22) = 2, f(3) = 3 and f(4) = 1. But (22, 3, 22, 4) is not equivalent to (1, 2, 2, 3). How many pairwise nonequivalent vectors are there in a given set of N vectors? First number contains T (T ≤ 10), number of test cases. Each test case consists of the following. First line consists of N and K (1 ≤ N ≤ 10000, 1 ≤ K ≤ 100). N lines follow, the i-th containing K integers describing the i-th vector. The vector values are from the range [0, 109]. Output one number: the number of different vectors. ## Input First number contains T (T ≤ 10), number of test cases. Each test case consists of the following. First line consists of N and K (1 ≤ N ≤ 10000, 1 ≤ K ≤ 100). N lines follow, the i-th containing K integers describing the i-th vector. The vector values are from the range [0, 109]. ## Output Output one number: the number of different vectors. [samples]
**Definitions** Let $ T \in \mathbb{Z} $ be the number of test cases. For each test case, let $ N, K \in \mathbb{Z} $ denote the number of vectors and their dimension, respectively. Let $ V = \{v_1, v_2, \dots, v_N\} $ be the set of vectors, where each $ v_i \in \mathbb{Z}^K $. **Equivalence Relation** Two vectors $ u, v \in \mathbb{Z}^K $ are equivalent ($ u \equiv v $) if there exists a bijection $ f: \text{Range}(u) \cup \text{Range}(v) \to \mathbb{Z} $ and an integer $ r \in \mathbb{Z} $ such that for all $ i \in \{0, 1, \dots, K-1\} $: $$ f(u_i) = v_i + r $$ **Constraints** 1. $ 1 \le T \le 10 $ 2. For each test case: - $ 1 \le N \le 10000 $ - $ 1 \le K \le 100 $ - Each component of every vector satisfies $ 0 \le v_{i,j} \le 10^9 $ **Objective** Compute the number of equivalence classes in $ V $ under $ \equiv $.
API Response (JSON)
{
  "problem": {
    "name": "D. Different vectors",
    "description": {
      "content": "You are given a set of N vectors, each vector consists of K integers. Vector X is equivalent to Y (denoted X ≡ Y) iff there exist a bijection  and an integer r, such that  for each i in the range [0..",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 65536
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10020D"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a set of N vectors, each vector consists of K integers. Vector X is equivalent to Y (denoted X ≡ Y) iff there exist a bijection  and an integer r, such that  for each i in the range [0.....",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case, let $ N, K \\in \\mathbb{Z} $ denote the number of vectors and their dimension, respectively.  \nLet $ V = \\{...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments