Submission #894325

# Submission time Handle Problem Language Result Execution time Memory
894325 2023-12-28T05:32:19 Z vjudge1 Rack (eJOI19_rack) C++17
0 / 100
0 ms 348 KB
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <functional>
#include <complex>
#include <climits>
#include <random>
using namespace std;
   
#define ll long long
#define pb push_back
#define ull unsigned long long
#define F first
#define S second
#define all(v) v.begin(), v.end()

const int INF = INT_MAX;
const int block = 500;
const ll mod = (ll) 1e9 + 7;

void solve(){
	ll ans = 0, c = 1;
         ll n, k;
	cin >> n >> k;
	k = k - 1;
	for(int i = 0; i < n - log2(k) - 1; i++){
		c = (c * 2) % mod;
	}
	for(int i = 0; i < 30; i++){
		if(k & (1 << i)){
			ans += c;
			if(ans > mod) ans -= mod;
		}
		c = (c * 2) % mod;
	}
	cout << ans + 1;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    int xach = 1; 
    //cin >> xach;
    while(xach--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -