답안 #1111859

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1111859 2024-11-13T07:37:05 Z vjudge1 Rack (eJOI19_rack) C++17
40 / 100
1 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()


typedef vector<int> vi;
typedef vector<char> vc;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<int,int> mii;
const int INF = 2e5 + 100;

int cal(int s,int e,int k){
	//cout << s << " " << e << " " << k << endl;
	if (k == 1) return s;
	int m = (e - s + 1) / 2;
	if (k%2 == 1){
		return cal(s,s + m -1, (k+1) / 2);
	}
	else return cal(s + m,e , (k+1) / 2);
}


int32_t main(){
	ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);

	int n,k; 
	cin >> n >> k;
	cout << cal(1,(1 << n),k);


	return 0;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 504 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 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 504 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Incorrect 1 ms 336 KB Output isn't correct
12 Halted 0 ms 0 KB -