update
This commit is contained in:
parent
20dae47adf
commit
2dff97c92c
@ -1,4 +1,5 @@
|
||||
#include <bits/stdc++.h>
|
||||
#include <execution>
|
||||
using namespace std;
|
||||
|
||||
using ll =int64_t;
|
||||
@ -15,8 +16,8 @@ int main(){
|
||||
for(int i=0;i<n;i++){
|
||||
cin >> a[i] >> d[i];
|
||||
}
|
||||
sort(a, a+n);
|
||||
sort(d, d+n);
|
||||
sort(execution::par, a, a+n);
|
||||
sort(execution::par, d, d+n);
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
for(int i=0;i<n;i++){
|
||||
|
31
src/20241121/U504526s2.cpp
Normal file
31
src/20241121/U504526s2.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using ll = int64_t;
|
||||
using namespace std;
|
||||
|
||||
const ll mod{ll(1e9+7)};
|
||||
ll m,q,n;
|
||||
|
||||
ll fpow(ll b,ll e){
|
||||
b%=mod;
|
||||
ll res{1};
|
||||
while(e!=0){
|
||||
if(e&1){
|
||||
res=res*b%mod;
|
||||
}
|
||||
b=b*b%mod;
|
||||
e>>=1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int main(){
|
||||
iostream::sync_with_stdio(0),cin.tie(0),cout.tie(0);
|
||||
|
||||
cin>>m>>q;
|
||||
for(ll i{1};i<=q;i++){
|
||||
cin>>n;
|
||||
cout<<fpow(2,n-1)<<'\n';
|
||||
}
|
||||
|
||||
}
|
49
src/test.cpp
49
src/test.cpp
@ -1,53 +1,6 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <ranges>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
using int64 = int64_t;
|
||||
|
||||
template<class ...Args>
|
||||
void input(Args&&...args){
|
||||
(std::cin>>...>>std::forward<Args>(args));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::remove_cvref_t<T> input(){
|
||||
std::remove_cvref_t<T> t;
|
||||
std::cin>>t;
|
||||
return t;
|
||||
}
|
||||
|
||||
template<class ...Args>
|
||||
void print(Args&&...args){
|
||||
(std::cout<<...<<std::forward<Args>(args));
|
||||
}
|
||||
|
||||
constexpr std::array<int64, (size_t)1e4+5> l2 = []()constexpr->std::remove_cvref_t<decltype(l2)>{
|
||||
std::remove_cvref_t<decltype(l2)> ret{};
|
||||
ret[1] = 0;
|
||||
for (const auto &i : std::ranges::views::iota((size_t)2, ret.size())) {
|
||||
ret[i] = ret[i/2] + 1;
|
||||
}
|
||||
return ret;
|
||||
}();
|
||||
|
||||
int64 lowbit(const int64 &num){
|
||||
return num&(-num);
|
||||
}
|
||||
|
||||
int main(){
|
||||
constexpr std::array arr{
|
||||
1,2,3, 4, 5
|
||||
};
|
||||
std::ranges::for_each(std::ranges::views::iota((int64)1, 1ll<<arr.size()), [&arr](auto i){
|
||||
while(i!=0){
|
||||
print(arr[l2[lowbit(i)]], ' ');
|
||||
i-=lowbit(i);
|
||||
}
|
||||
print('\n');
|
||||
});
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user