Submission #284427

# Submission time Handle Problem Language Result Execution time Memory
284427 2020-08-27T11:32:36 Z lukameladze Rack (eJOI19_rack) C++14
40 / 100
135 ms 102404 KB
# include <bits/stdc++.h>
using namespace std;
long long n,k,pw[1000005],x,ww;
vector <long long> v;
int main()
{
     cin>>n>>k;
     pw[0]=1;
     for (int i=1; i<=n; i++)
     pw[i]=pw[i-1]*2;
     v.push_back(1);
     v.push_back(pw[n-1]+1);
     x=(n-1);
     if (k<=2)
     {
          cout<<v[k-1]<<endl;
          return 0;
     }
     while (true)
     {
     	x--;
     	ww=v.size();
     	for (int i=0; i<ww; i++)
     	{
     		v.push_back(v[i]+pw[x]);
     	//	cout<<v[i]<<" "<<pw[x]<<endl;
		}
		if (v.size()>=k) break;
	 }
	 cout<<v[k-1]<<endl;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:28:15: 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]
   28 |   if (v.size()>=k) break;
      |       ~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 1020 KB Output is correct
9 Correct 4 ms 2548 KB Output is correct
10 Correct 4 ms 2548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 1020 KB Output is correct
9 Correct 4 ms 2548 KB Output is correct
10 Correct 4 ms 2548 KB Output is correct
11 Runtime error 135 ms 102404 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -