답안 #634721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634721 2022-08-24T18:07:41 Z smartmonky Rack (eJOI19_rack) C++14
40 / 100
8 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+3,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<1000;i++){
		int s=n;
		for(int j=0;j<=min(n,59LL);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 7 ms 8076 KB Output is correct
2 Correct 8 ms 8020 KB Output is correct
3 Correct 8 ms 8072 KB Output is correct
4 Correct 7 ms 8020 KB Output is correct
5 Correct 7 ms 8080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8076 KB Output is correct
2 Correct 8 ms 8020 KB Output is correct
3 Correct 8 ms 8072 KB Output is correct
4 Correct 7 ms 8020 KB Output is correct
5 Correct 7 ms 8080 KB Output is correct
6 Correct 7 ms 8020 KB Output is correct
7 Correct 7 ms 8124 KB Output is correct
8 Correct 7 ms 8012 KB Output is correct
9 Correct 8 ms 8008 KB Output is correct
10 Correct 8 ms 8020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8076 KB Output is correct
2 Correct 8 ms 8020 KB Output is correct
3 Correct 8 ms 8072 KB Output is correct
4 Correct 7 ms 8020 KB Output is correct
5 Correct 7 ms 8080 KB Output is correct
6 Correct 7 ms 8020 KB Output is correct
7 Correct 7 ms 8124 KB Output is correct
8 Correct 7 ms 8012 KB Output is correct
9 Correct 8 ms 8008 KB Output is correct
10 Correct 8 ms 8020 KB Output is correct
11 Correct 7 ms 8060 KB Output is correct
12 Correct 7 ms 8124 KB Output is correct
13 Correct 7 ms 8104 KB Output is correct
14 Correct 7 ms 8020 KB Output is correct
15 Incorrect 7 ms 8020 KB Output isn't correct
16 Halted 0 ms 0 KB -