0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 14:56:27 +00:00

#1694. 【2022.10.25 联考】先辈

https://sjzezoj.com/submission/62212
This commit is contained in:
Baoshuo Ren 2022-10-27 13:00:06 +08:00
parent da14ac1cff
commit 50beaaf16a
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
88 changed files with 330 additions and 0 deletions

69
S2OJ/1694/1694.cpp Normal file
View File

@ -0,0 +1,69 @@
#include <iostream>
#include <algorithm>
#include <string>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 5e5 + 5;
const int mod = 114514;
int n, sum[N][26], pre[26][26], suf[26][26], cnt[26];
long long ans;
std::string s;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> s;
n = s.size();
s = ' ' + s;
for (int i = 1; i <= n; i++) {
std::copy_n(sum[i - 1], 26, sum[i]);
sum[i][s[i] - 'a']++;
}
for (int i = n; i; i--) {
cnt[s[i] - 'a']++;
for (int j = 0; j < 26; j++) {
if (s[i] - 'a' == j) continue;
suf[s[i] - 'a'][j] = (suf[s[i] - 'a'][j] + cnt[j]) % mod;
}
}
std::fill_n(cnt, 26, 0);
for (int i = 1; i <= n; i++) {
cnt[s[i] - 'a']++;
for (int j = 0; j < 26; j++) {
if (cnt[j] < 2 || s[i] - 'a' == j) continue;
pre[s[i] - 'a'][j] = (pre[s[i] - 'a'][j] + (static_cast<long long>(cnt[j]) * (cnt[j] - 1) / 2) % mod) % mod;
}
for (int j = 0; j < 26; j++) {
if (s[i] - 'a' == j) continue;
suf[s[i] - 'a'][j] = (suf[s[i] - 'a'][j] - (sum[n][j] - sum[i - 1][j]) % mod + mod) % mod;
}
for (int j = 0; j < 26; j++) {
for (int k = 0; k < 26; k++) {
if (j == k || j == s[i] - 'a' || k == s[i] - 'a') continue;
ans += static_cast<long long>(pre[k][j]) * suf[j][k];
}
}
ans %= mod;
}
cout << ans << endl;
return 0;
}

BIN
S2OJ/1694/data/anc1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc12.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc13.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc14.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc15.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc16.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc17.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc18.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc19.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc20.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc21.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc21.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc22.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc22.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc23.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc23.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc24.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc24.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc25.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc25.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc26.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc26.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc27.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc27.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc28.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc28.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc29.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc29.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc30.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc30.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc31.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc31.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc32.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc32.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc33.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc33.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc34.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc34.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc35.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc35.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc36.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc36.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc37.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc37.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc38.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc38.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc39.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc39.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc40.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc40.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/anc9.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/ex_anc1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/ex_anc1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/ex_anc2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/ex_anc2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/ex_anc3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/ex_anc3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1694/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.