Submission #637331

# Submission time Handle Problem Language Result Execution time Memory
637331 2022-09-01T11:35:26 Z ksu2009en Rack (eJOI19_rack) C++14
0 / 100
1 ms 304 KB
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>

using namespace std;
typedef long long ll;

int main(){
    
    ll n, k;
    cin >> n >> k;
    
    
    
    vector<ll>a;
    
    ll c = (1 << n) / 4, add = (1 << (n - 1));
    
    a.push_back(1);
    a.push_back(1 + (1 << (n - 1)));
    
    while(c > 0){
        ll c2 = c;
        for(; c2 <= (1 << n) /2; c2 += add){
            a.push_back(c2 + 1);
            a.push_back(c2 + 1 + (1 << (n - 1)));
        }
        //cout << c << ' ' << add << endl;
        if(c == 1)
            break;
        
        add /= 2;
        c /= 2;
    }
    
    cout << a[k - 1] << endl;
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -