답안 #634724

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634724 2022-08-24T18:09:39 Z smartmonky Rack (eJOI19_rack) C++14
100 / 100
10 ms 8124 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
 
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int ll
using namespace std;
const int N=1e6+6,mod=1e9+7;
int pw[N];
main(){
    int n,k;
    cin >>n >>k;
    pw[0]=1;
    int ans=0;
	for(int i=1;i<N;i++)
		pw[i]=(pw[i-1]*2)%mod;
	for(int i=0;i<60;i++){
		int s=n;
		for(int j=0;j<=n;j++){
			if(k<=(1LL <<j)){
				if(j==0){
					cout<<(ans+1)%mod;
					exit(0);
				}
				ans=(ans+pw[s])%mod;
				k-=(1LL << (j-1));
				break;
			}else
				s--;
		}
	}
}

Compilation message

rack.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 8020 KB Output is correct
2 Correct 8 ms 8032 KB Output is correct
3 Correct 7 ms 8020 KB Output is correct
4 Correct 8 ms 8028 KB Output is correct
5 Correct 7 ms 8012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 8020 KB Output is correct
2 Correct 8 ms 8032 KB Output is correct
3 Correct 7 ms 8020 KB Output is correct
4 Correct 8 ms 8028 KB Output is correct
5 Correct 7 ms 8012 KB Output is correct
6 Correct 9 ms 8020 KB Output is correct
7 Correct 7 ms 8020 KB Output is correct
8 Correct 7 ms 8020 KB Output is correct
9 Correct 9 ms 8124 KB Output is correct
10 Correct 7 ms 8020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 8020 KB Output is correct
2 Correct 8 ms 8032 KB Output is correct
3 Correct 7 ms 8020 KB Output is correct
4 Correct 8 ms 8028 KB Output is correct
5 Correct 7 ms 8012 KB Output is correct
6 Correct 9 ms 8020 KB Output is correct
7 Correct 7 ms 8020 KB Output is correct
8 Correct 7 ms 8020 KB Output is correct
9 Correct 9 ms 8124 KB Output is correct
10 Correct 7 ms 8020 KB Output is correct
11 Correct 8 ms 8020 KB Output is correct
12 Correct 10 ms 8020 KB Output is correct
13 Correct 8 ms 8092 KB Output is correct
14 Correct 9 ms 8020 KB Output is correct
15 Correct 8 ms 8056 KB Output is correct