Submission #497486

# Submission time Handle Problem Language Result Execution time Memory
497486 2021-12-23T06:45:42 Z Karabasan Rack (eJOI19_rack) C++17
40 / 100
4 ms 4544 KB
#include <bits/stdc++.h>
#define ll long long
#define fast1 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,avx")
#pragma GCC optimize("unroll-loops")

int n,k;
vector<int> v;
void solve()
{
    cin>>n>>k;
    int deg=(1<<(n-1));
    v.push_back(1);
    while(v.size()<=(1<<(n-1)))
    {
        int a=v.size();
        for(int i=0;i<a;i++)
            v.push_back(v[i]+deg);
        deg/=2;
    }
    cout<<v[k-1];
}
signed main()
{
    //fast1
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Compilation message

rack.cpp: In function 'void solve()':
rack.cpp:17:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     while(v.size()<=(1<<(n-1)))
      |           ~~~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 272 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 272 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 292 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 1352 KB Output is correct
10 Correct 4 ms 4544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 272 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 292 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 1352 KB Output is correct
10 Correct 4 ms 4544 KB Output is correct
11 Runtime error 1 ms 336 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -