제출 #272806

#제출 시각아이디문제언어결과실행 시간메모리
272806EJOI2019AndrewRack (eJOI19_rack)C++14
0 / 100
1 ms256 KiB
#include<bits/stdc++.h> using namespace std; #define MOD 1000000007 long long int q(long long int a,long long b) { long long pr=1; while(b!=0) { if(b%2==1) pr=(pr*a)%MOD; b/=2; a=(a*a)%MOD; } return pr; } long long int rack(long long int n,long long int k) { long long int l(0),r(q(2,n)%MOD); map<long long int,int>freq; while(k) { if(freq[k]>1&&k==1) return (l%MOD); long long int mid=((l+r)%MOD/2)%MOD; if(k%2) r=mid-1; else l=mid+1; int fr(k%2); k/=2; k+=fr; ++freq[k]; } return l%MOD; } int main() { //EWEX //SXSN //WSEX long long int n,k; cin>>n>>k; cout<<rack(n,k); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...