Submission #532655

# Submission time Handle Problem Language Result Execution time Memory
532655 2022-03-03T14:45:17 Z Doman Rack (eJOI19_rack) C++17
100 / 100
9 ms 332 KB
#include<bits/stdc++.h>
using namespace std;
constexpr int mod=1e9+7;
constexpr int eps=1e-6;
constexpr int nax=2e5+5;
constexpr int base=(1<<19);
constexpr long long inf=1e9+1;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ll long long
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pkt pair<int,int> 

int main(){
	IOS;  
	ll n,k; 
	cin>>n>>k; 
	k--;
	int ans=1; 
	for(int i=1;i<=n;i++){ 
		if(k%2==0){ 
			ans=(ans*2)%mod;
		}
		else{ 
			ans=(ans*2+1)%mod;
		}
		k/=2;
	}
	int pot2=1; 
	for(int i=1;i<=n;i++){ 
		pot2=(2*pot2)%mod;
	}
	cout<<(ans-pot2+1+mod)%mod;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 9 ms 316 KB Output is correct