답안 #929361

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
929361 2024-02-18T05:07:40 Z erkhem Rack (eJOI19_rack) C++14
40 / 100
50 ms 102400 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'
#define ff first
#define ss second
#define rev reverse
#define pb push_back
#define all(a) a.begin(), a.end()
#define maxx(a, b) a = max(a, b);
#define minn(a, b) a = min(a, b);
#define fastio cin.tie(0)->sync_with_stdio(0)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<bool> vb;
typedef vector<string> vs;

const int mod = 1e9 + 7;
const int inf = 1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};

int32_t main() {
	fastio;
	int n, k;
	cin >> n >> k;
	n = 1 << n;
	vi a(n + 1);
	rep1(i, n) {
		a[i] = i;
	}
	int s = 1, t = n / 2 + 1;
	vi ans;
	ans.pb(s);
	ans.pb(t);
	int sz = n / 4;
	while (1) {
		if (ans.size() >= k) break;
		int m = ans.size();
		rep(i, m) {
			ans.pb(ans[i] + sz);
		}
		sz /= 2;
	}
	cout << ans[k - 1] << endl;;
	return 0;
}

Compilation message

rack.cpp: In function 'int32_t main()':
rack.cpp:44:18: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   44 |   if (ans.size() >= k) break;
      |       ~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 1500 KB Output is correct
9 Correct 3 ms 4568 KB Output is correct
10 Correct 4 ms 10820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 1500 KB Output is correct
9 Correct 3 ms 4568 KB Output is correct
10 Correct 4 ms 10820 KB Output is correct
11 Runtime error 50 ms 102400 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -