Submission #284066

# Submission time Handle Problem Language Result Execution time Memory
284066 2020-08-26T16:12:17 Z Patrusheva_Anna Rack (eJOI19_rack) C++14
40 / 100
132 ms 102404 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")

#define ll long long
#define pb push_back
#define F first
#define S second
#define ull unsigned long long
#define pii pair < int, int >
#define ld long double


using namespace std;
using namespace __gnu_pbds;

mt19937 gen(time(0));
template <typename T>
using ordered_set=tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 100000 * 5;


int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);


#ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#else

#endif


    int n, k;
    cin >> n >> k;
    vector < int > p;
    p.pb(1);
    int now = (1 << n) / 2;
    while (p.size() < k)
    {
        int m = p.size();
        for (int i = 0; i < m && p.size() < k; i++)
            p.pb(p[i] + now);
        now /= 2;
    }

    cout << p[p.size() - 1];




    return 0;

}

Compilation message

rack.cpp: In function 'int32_t main()':
rack.cpp:48:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |     while (p.size() < k)
      |            ~~~~~~~~~^~~
rack.cpp:51:43: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   51 |         for (int i = 0; i < m && p.size() < k; i++)
      |                                  ~~~~~~~~~^~~
# 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 384 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 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 2 ms 1532 KB Output is correct
10 Correct 2 ms 1508 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 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 2 ms 1532 KB Output is correct
10 Correct 2 ms 1508 KB Output is correct
11 Runtime error 132 ms 102404 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -