Submission #1112008

# Submission time Handle Problem Language Result Execution time Memory
1112008 2024-11-13T13:52:48 Z vjudge1 Rack (eJOI19_rack) C++17
100 / 100
3 ms 8016 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int t,n,a,b,cevap,k,pw[1000005];

inline int add(int x,int y){
	if(x+y>=1000000007)return x+y-1000000007;
	return x+y;
}

int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>k;
	pw[0]=1;
	for(int i=1;i<=n;i++){
		pw[i]=add(pw[i-1],pw[i-1]);
	}
	cevap=1;
	int us=n-1;
	while(k!=1){
		if(k%2==0)cevap=add(cevap,pw[us]);
		us--;
		k=(k+1)/2;
	}
	cout<<cevap<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 2640 KB Output is correct
15 Correct 3 ms 8016 KB Output is correct