社区讨论
95pts玄关求调!!
P7076[CSP-S 2020] 动物园参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mhizcj03
- 此快照首次捕获于
- 2025/11/03 18:11 4 个月前
- 此快照最后确认于
- 2025/11/03 18:11 4 个月前
CPP
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef unsigned long long ULL;
int main()
{
int n, m, c, k;
cin >> n >> m >> c >> k;
ULL cow = 0;
for(int i = 0; i < n; i++) {
ULL x;
cin >> x;
cow |= x;
}
ULL f = 0;
for(int i = 0; i < m; i++) {
int p, q;
cin >> p >> q;
if(!(cow >> p & 1)) {
f |= (1ULL << p);
}
}
int av = k;
for(int i = 0; i < k; i++) {
if(f >> i & 1) {
av --;
}
}
ULL total;
if(av == 64) {
total = 0;
total = total - n;
} else {
total = (1ULL << av);
if(total < n) {
total = 0;
} else {
total -= n;
}
}
cout << total << "\n";
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...