Submission #981673

# Submission time Handle Problem Language Result Execution time Memory
981673 2024-05-13T12:39:07 Z Nomio Rack (eJOI19_rack) C++17
40 / 100
50 ms 102400 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	if(k == 1) {
		cout << 1 << '\n';
		return 0;
	}
	vector<int> v;
	v.push_back(1);
	while(v.size() < k) {
		n--;
		int m = v.size();
		for(int i = 0; i < m; i++) {
			int x = v[i] + (1 << n);
			v.push_back(x);
		}
	}
	cout << v[k - 1] << '\n';
	return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:12:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |  while(v.size() < k) {
      |        ~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 728 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 728 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1492 KB Output is correct
11 Runtime error 50 ms 102400 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -