Submission #631182

# Submission time Handle Problem Language Result Execution time Memory
631182 2022-08-17T18:48:57 Z smartmonky Rack (eJOI19_rack) C++14
40 / 100
8 ms 8604 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
map <int,int> mp;
main(){
	int n,k;
	cin >>n >>k;
	int x=(1 << n);
	vector <int> v(x+1);
	vector <int> ans;
	v[1]=1;
	ans.pb(1);
	v[2]=x/2+1;
	ans.pb(v[2]);
	int cnt=2;
	for(int i=x/4;i>=1;i/=2){
		for(int j=1;j<=cnt;j++){
		//	cout<<cnt+j <<" ";
			v[cnt+j]=v[j]+i;
			ans.pb(v[j]+i);
		}
		cnt*=2;
	}
	//for(int i=1;i<=x;i++)
	//	cout<<v[i] <<" ";
	cout<<ans[k-1];
}

Compilation message

rack.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 852 KB Output is correct
9 Correct 2 ms 2380 KB Output is correct
10 Correct 8 ms 8604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 852 KB Output is correct
9 Correct 2 ms 2380 KB Output is correct
10 Correct 8 ms 8604 KB Output is correct
11 Runtime error 1 ms 340 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -