답안 #406573

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
406573 2021-05-17T18:18:01 Z Ronin13 Rack (eJOI19_rack) C++14
40 / 100
12 ms 6592 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ull unsigned ll
#define pb push_back
#define epb emplace_back
#define INF 1e9+1;
using namespace std;

void solve(){
    int n,k;cin>>n>>k;
    vector<int>vec;
    vec.pb(1);
    vec.pb((1<<(n-1))+1);
    int j=(1<<(n-1));
    j/=2;
    while(j){
        vector<int>add;
        for(int i=0;i<vec.size();i++){
            add.pb(vec[i]+j);
        }
        for(int to:add)vec.pb(to);
        j/=2;
    }
    cout<<vec[k-1]<<' ';
}
int main(){
    int t;t=1;
    while(t--){
        solve();
    }
}

Compilation message

rack.cpp: In function 'void solve()':
rack.cpp:22:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for(int i=0;i<vec.size();i++){
      |                     ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 844 KB Output is correct
9 Correct 4 ms 1860 KB Output is correct
10 Correct 12 ms 6592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 844 KB Output is correct
9 Correct 4 ms 1860 KB Output is correct
10 Correct 12 ms 6592 KB Output is correct
11 Runtime error 1 ms 332 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -