update
This commit is contained in:
parent
3eff188a70
commit
1e9f0b6c84
52
src/CSP-S2020/zoo/zoo.cpp
Normal file
52
src/CSP-S2020/zoo/zoo.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
|
||||
using ull = unsigned long long;
|
||||
|
||||
ull n, m, c, k, input, _;
|
||||
const ull max_k = 64+5;
|
||||
// const ull max_n = 1e6+5;
|
||||
ull used_bits;
|
||||
std::bitset<max_k> vis_bits;
|
||||
|
||||
#define NV(v)#v<<" : "<<(v)
|
||||
|
||||
#ifdef ONLINE_JUDGE
|
||||
#define DEBUG(code)
|
||||
#else
|
||||
#define DEBUG(code)code
|
||||
#endif
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
std::iostream::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
|
||||
|
||||
std::cin>>n>>m>>c>>k;
|
||||
|
||||
if(n==0 && m==0 && k==64){
|
||||
std::cout<<"18446744073709551616\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(ull i{1};i<=n;i++){
|
||||
std::cin>>input;
|
||||
DEBUG(std::cout<<NV(input)<<" ";)
|
||||
DEBUG(std::cout<<NV(std::bitset<4>(input))<<" ";)
|
||||
used_bits |= input;
|
||||
DEBUG(std::cout<<'\n';)
|
||||
}
|
||||
for(ull i{1};i<=m;i++){
|
||||
std::cin>>input>>_;
|
||||
if(!((used_bits>>input)&1) && vis_bits[input]==false){
|
||||
DEBUG(std::cout<<"unused_bit++ ;"<<NV(input)<<'\n';)
|
||||
k--;
|
||||
vis_bits[input] = true;
|
||||
}
|
||||
}
|
||||
const auto left_shift = [](const ull n, const ull num)->ull{
|
||||
return num < 64 ? n<<num : 0;
|
||||
};
|
||||
DEBUG(std::cout<<NV(k)<<'\n';)
|
||||
std::cout<<(left_shift(1, k)) - n<<'\n';
|
||||
}
|
30
src/P7913/P7913.cpp
Normal file
30
src/P7913/P7913.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
using ll = long long;
|
||||
|
||||
template<class ...Args>
|
||||
void read(Args&...args){
|
||||
(std::cin>>...>>args);
|
||||
}
|
||||
|
||||
template<class ...Args>
|
||||
void print(const Args&...args){
|
||||
(std::cout<<...<<args);
|
||||
}
|
||||
|
||||
const ll max_m = 1e5;
|
||||
ll n, m1, m2, arr1[max_m], arr2[max_m];
|
||||
|
||||
|
||||
int main(){
|
||||
read(n,m1,m2);
|
||||
for(ll i{1};i<=m1;i++){
|
||||
ll a,b;
|
||||
read(a, b);
|
||||
|
||||
}
|
||||
for(ll i{1};i<=m2;i++){
|
||||
ll a, b;
|
||||
read(a, b);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user