Given a string, we need to find the total number of its distinct substrings. Input T- number of test cases. T<=20; Each test case consists of one string, whose length is <= 50000 Output For each test case output one number saying the number of disti…
传送门 双倍经验(弱化版本) 考虑求出来heightheightheight数组之后用增量法. 也就是考虑每增加一个heightheightheight对答案产生的贡献. 算出来是∑∣S∣−heighti+1−sai\sum|S|-height_i+1-sa_i∑∣S∣−heighti+1−sai 代码: #include<bits/stdc++.h> #define ri register int using namespace std; const int N=5e4+5; int n…