mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 13:58:48 +00:00
2460. [BeiJing2011] 元素
https://hydro.ac/d/bzoj/record/6322f07e32ae6c3198cca121
This commit is contained in:
parent
4ba381064b
commit
273f8ac7ff
52
BZOJ/2460/2460.cpp
Normal file
52
BZOJ/2460/2460.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 1005;
|
||||||
|
|
||||||
|
int n, ans;
|
||||||
|
std::pair<int, unsigned long long> a[N];
|
||||||
|
unsigned long long p[N];
|
||||||
|
|
||||||
|
inline bool insert(unsigned long long x) {
|
||||||
|
for (int i = 0; i <= 61; i++) {
|
||||||
|
if (x & (1ull << i)) {
|
||||||
|
if (p[i]) {
|
||||||
|
x ^= p[i];
|
||||||
|
} else {
|
||||||
|
p[i] = x;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
cin >> a[i].second >> a[i].first;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(a + 1, a + 1 + n, std::greater<std::pair<int, unsigned long long>>());
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
if (insert(a[i].second)) {
|
||||||
|
ans += a[i].first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
BZOJ/2460/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/6.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/6.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/7.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/7.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/8.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/8.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/9.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2460/data/9.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2460/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user