Submission #253842

#TimeUsernameProblemLanguageResultExecution timeMemory
253842fivefourthreeonecmp (balkan11_cmp)C++17
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "cmp.h" #define owo(i,a, b) for(int i=(a);i<(b); ++i) #define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i) #define senpai push_back #define ttgl pair<int, int> #define ayaya cout<<"ayaya~"<<endl using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; gp_hash_table<int, int> mp; using ll = long long; using ld = long double; const ll MOD = 1000000007; const ll root = 62; int gcd(int a,int b){return b?gcd(b,a%b):a;} ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;} ll modInv(ll a){return binpow(a, MOD-2);} const double PI = acos(-1); const double eps = -1e6; const int INF = 0x3f3f3f3f; const int NINF = 0xc0c0c0c0; const ll INFLL = 0x3f3f3f3f3f3f3f3f; const ll NINFLL = 0xc0c0c0c0c0c0c0c0; //write a as power of 4, binary search down and compare at the end; /*bool stuff[4097][10241]; int idx1; int idx2; int num; void bit_set(int a) { idx1++; stuff[num][a] = true; } int bit_get(int a) { idx2++; return stuff[num][a]; }*/ int fours[6] = {1, 4, 16, 64, 256, 1024}; void remember(int a) { owo(i, 0, 6) { bit_set(a); a/=4; } } int compare(int b) { int l = 0; int r = 5; while(l<r) { int mid = (l+r)/2; if(bit_get(b/fours[mid]))r = mid; else l = mid+1; } if(l==0)return 0; int curr = b/fours[l]; int diff = (b/fours[l-1]-(4*curr)); if(diff==0) { return -1; }else if(diff==3) { return 1; }else if(diff==1) { if(bit_get(curr*fours[l]))return 1; else return -1; }else { if(bit_get(curr*fours[l]+3))return -1; else return 1; } } /*int main() { //freopen("file.in", "r", stdin); //freopen("file.out", "w", stdout); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); cin.tie(0)->sync_with_stdio(0); int n, m; cin>>n>>m; remember(n); cout<<compare(m)<<" "<<idx1<<" "<<idx2<<"\n"; return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...