I. Incomparable Pairs

Codeforces
IDCF10212I
Time3000ms
Memory512MB
Difficulty
English · Original
Formal · Original
You are given a string s = s1s2... sn. Consider an unordered pair of its substrings {a, b}. Let us call such pair _incomparable_ if neither a is a substring of b nor b is a substring of a. You have to compute the number of incomparable pairs of substrings of s. The first line of input contains a single string s consisting of lowercase English letters (1 ≤ |s| ≤ 105). Output a single integer which is the answer to the problem. ## Input The first line of input contains a single string s consisting of lowercase English letters (1 ≤ |s| ≤ 105). ## Output Output a single integer which is the answer to the problem. [samples]
**Definitions** Let $ s = s_1 s_2 \dots s_n $ be a string of length $ n \geq 1 $ over the alphabet of lowercase English letters. Let $ \mathcal{S} $ be the set of all non-empty substrings of $ s $. **Constraints** $ 1 \leq n \leq 10^5 $ **Objective** Compute the number of unordered pairs $ \{a, b\} \subseteq \mathcal{S} $, $ a \neq b $, such that neither $ a $ is a substring of $ b $ nor $ b $ is a substring of $ a $.
API Response (JSON)
{
  "problem": {
    "name": "I. Incomparable Pairs",
    "description": {
      "content": "You are given a string s = s1s2... sn. Consider an unordered pair of its substrings {a, b}. Let us call such pair _incomparable_ if neither a is a substring of b nor b is a substring of a. You have to",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 524288
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10212I"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a string s = s1s2... sn. Consider an unordered pair of its substrings {a, b}. Let us call such pair _incomparable_ if neither a is a substring of b nor b is a substring of a. You have to...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ s = s_1 s_2 \\dots s_n $ be a string of length $ n \\geq 1 $ over the alphabet of lowercase English letters.  \nLet $ \\mathcal{S} $ be the set of all non-empty substrings of $ s $...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments