Submission #435038

#TimeUsernameProblemLanguageResultExecution timeMemory
435038NintsiChkhaidzeRack (eJOI19_rack)C++14
40 / 100
85 ms11128 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define left (node<<1),l,((l+r)>>1) #define right ((node<<1)|1),((l+r)>>1) + 1,r #define s second #define f first using namespace std; vector <int> v; map <int,int> f; int main (){ ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); int n,k; cin>>n>>k; int a = (1<<(n - 1)); v.pb(1); if (k == 1){ cout<<1; return 0; } f[1] = 1; while(a){ int id = 0; while(id < v.size() && v[id] + a <= (1<<n) && !f[v[id] + a]){ f[v[id] + a] = 1; v.pb(v[id] + a); if (v.size() == k) { cout<<v[id] + a; return 0; } id++; } a/=2; } }

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         while(id < v.size() && v[id] + a <= (1<<n) && !f[v[id] + a]){
      |               ~~~^~~~~~~~~~
rack.cpp:29:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |             if (v.size() == k) {
      |                 ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...