Skip to content

Instantly share code, notes, and snippets.

@key-moon
Created March 6, 2024 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save key-moon/089e58fd7291e5f0ad3d0b36304f143e to your computer and use it in GitHub Desktop.
Save key-moon/089e58fd7291e5f0ad3d0b36304f143e to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
bitset<50000> bs;
bs[0] = 1;
ll t = (ll)1e6;
for (ll i = 0; i < t; i++) {
bs ^= bs >> 12;
bs ^= bs << 30;
}
cout << bs.count() << endl;
}
#pragma GCC target("arch=x86-64-v4")
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
bitset<50000> bs;
bs[0] = 1;
ll t = (ll)1e6;
for (ll i = 0; i < t; i++) {
bs ^= bs >> 12;
bs ^= bs << 30;
}
cout << bs.count() << endl;
}
#pragma GCC target("arch=x86-64-v4")
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll s = 1;
ll t = (ll)1e3;
ll b = (ll)1e4;
set<ll> st;
for (ll i = 0; i < t; i++) {
st.clear();
for (int i = 0; i < b; i++) {
s *= 0xcafebabedeadbeef;
st.emplace(s);
}
}
_exit(0);
}
#pragma GCC target("arch=x86-64-v4")
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll s = 1;
ll t = (ll)1e3;
ll b = (ll)1e4;
unordered_set<ll> st;
for (ll i = 0; i < t; i++) {
st.clear();
for (int i = 0; i < b; i++) {
s *= 0xcafebabedeadbeef;
st.emplace(s);
}
}
_exit(0);
}
#include<bits/stdc++.h>
using namespace std;
int main() {
int size = 100000;
vector<int> hoge(size);
iota(hoge.begin(), hoge.end(), 0);
for (int j = 0; j < size; j++)
for (int i = 0; i < 1e5; i++)
hoge[j] ^= hoge[j] << 10;
int res = accumulate(hoge.begin(), hoge.end(), 0);
cout << res << endl;
}
#pragma GCC target("arch=x86-64-v4")
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
int main() {
int size = 100000;
vector<int> hoge(size);
iota(hoge.begin(), hoge.end(), 0);
for (int j = 0; j < size; j++)
for (int i = 0; i < 1e5; i++)
hoge[j] ^= hoge[j] << 10;
int res = accumulate(hoge.begin(), hoge.end(), 0);
cout << res << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment