0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 15:58:47 +00:00

#1558. 【2022.9.14 联考】3aab198230b8fd9f

https://sjzezoj.com/submission/56419
This commit is contained in:
Baoshuo Ren 2022-09-14 15:38:17 +08:00
parent 9e5828a521
commit b4b5c2040e
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
42 changed files with 162 additions and 0 deletions

39
S2OJ/1558/1558.cpp Normal file
View File

@ -0,0 +1,39 @@
#include <iostream>
#include <unordered_map>
#include <unordered_set>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e6 + 5;
int n, m, a[N];
long long ans;
std::unordered_set<int> set;
std::unordered_map<int, int> map;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1, j = 0; i <= n - m + 1; i++) {
while (j < n && set.size() < m) {
set.insert(a[++j]);
map[a[j]]++;
}
if (set.size() == m) ans += n - j + 1;
if (!--map[a[i]]) set.erase(a[i]);
}
cout << ans << endl;
return 0;
}

BIN
S2OJ/1558/data/mdv1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv12.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv13.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv14.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv15.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv16.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv17.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv18.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv19.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv20.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1558/data/mdv9.out (Stored with Git LFS) Normal file

Binary file not shown.

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

Binary file not shown.