답안 #964824

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964824 2024-04-17T15:41:50 Z pcc Rack (eJOI19_rack) C++17
100 / 100
5 ms 8284 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>

const ll mxn = 1e6+10;
const ll mod = 1e9+7;
ll N,K;
ll pw[mxn];

ll mad(ll a,ll b){
	if(a>mod)a %= mod;
	if(b>mod)b %= mod;
	a += b;
	return a>=mod?a-mod:a;
}
ll mub(ll a,ll b){
	return mad(a,mod-b);
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	pw[0] = 1;
	for(int i = 1;i<mxn;i++)pw[i] = mad(pw[i-1],pw[i-1]);
	cin>>N>>K;
	ll ans = 0;
	N--;
	K--;
	ll now = 0;
	while(N>60){
		now++;N--;
	}
	while(N>=0){
		if((1ll<<N)<=K){
			K -= 1ll<<N;
			ans = mad(ans,pw[now]);
		}
		now++;N--;
	}
	cout<<mad(ans,1)<<'\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8024 KB Output is correct
2 Correct 3 ms 8284 KB Output is correct
3 Correct 3 ms 8280 KB Output is correct
4 Correct 3 ms 8028 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8024 KB Output is correct
2 Correct 3 ms 8284 KB Output is correct
3 Correct 3 ms 8280 KB Output is correct
4 Correct 3 ms 8028 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
6 Correct 3 ms 8024 KB Output is correct
7 Correct 3 ms 8028 KB Output is correct
8 Correct 3 ms 8076 KB Output is correct
9 Correct 3 ms 8028 KB Output is correct
10 Correct 3 ms 8092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8024 KB Output is correct
2 Correct 3 ms 8284 KB Output is correct
3 Correct 3 ms 8280 KB Output is correct
4 Correct 3 ms 8028 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
6 Correct 3 ms 8024 KB Output is correct
7 Correct 3 ms 8028 KB Output is correct
8 Correct 3 ms 8076 KB Output is correct
9 Correct 3 ms 8028 KB Output is correct
10 Correct 3 ms 8092 KB Output is correct
11 Correct 3 ms 8024 KB Output is correct
12 Correct 3 ms 8028 KB Output is correct
13 Correct 3 ms 8024 KB Output is correct
14 Correct 3 ms 8280 KB Output is correct
15 Correct 4 ms 8284 KB Output is correct