mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 20:48:48 +00:00
1702. [Usaco2007 Mar]Gold Balanced Lineup 平衡的队列
https://hydro.ac/d/bzoj/record/63a46372b053be17396a0c2c
This commit is contained in:
parent
5a5b1bbe2c
commit
21baf77ed2
43
BZOJ/1702/1702.cpp
Normal file
43
BZOJ/1702/1702.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int n, m, ans;
|
||||
std::map<std::vector<int>, int> map;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> m;
|
||||
|
||||
std::vector<int> s(m);
|
||||
|
||||
map[s] = 0;
|
||||
for (int i = 1, x; i <= n; i++) {
|
||||
cin >> x;
|
||||
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (x >> j & 1) s[j]++;
|
||||
}
|
||||
|
||||
if (!std::count(s.begin(), s.end(), 0)) {
|
||||
for (int& x : s) x--;
|
||||
}
|
||||
|
||||
if (map.count(s)) {
|
||||
ans = std::max(ans, i - map[s]);
|
||||
} else {
|
||||
map[s] = i;
|
||||
}
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
BZOJ/1702/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/11.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/11.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/12.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/12.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/6.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/6.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/7.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/7.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/8.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/8.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/9.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/1702/data/9.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/1702/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user