Submission #964823

# Submission time Handle Problem Language Result Execution time Memory
964823 2024-04-17T15:40:22 Z pcc Rack (eJOI19_rack) C++17
40 / 100
4 ms 8440 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){
		ans = mad(ans,pw[now]);
		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;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8280 KB Output is correct
2 Correct 3 ms 8280 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 4 ms 8440 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8280 KB Output is correct
2 Correct 3 ms 8280 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 4 ms 8440 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
6 Correct 4 ms 8028 KB Output is correct
7 Correct 3 ms 8284 KB Output is correct
8 Correct 3 ms 8280 KB Output is correct
9 Correct 3 ms 8284 KB Output is correct
10 Correct 3 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8280 KB Output is correct
2 Correct 3 ms 8280 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 4 ms 8440 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
6 Correct 4 ms 8028 KB Output is correct
7 Correct 3 ms 8284 KB Output is correct
8 Correct 3 ms 8280 KB Output is correct
9 Correct 3 ms 8284 KB Output is correct
10 Correct 3 ms 8284 KB Output is correct
11 Correct 4 ms 8284 KB Output is correct
12 Incorrect 4 ms 8284 KB Output isn't correct
13 Halted 0 ms 0 KB -