답안 #1097239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097239 2024-10-06T14:34:53 Z vjudge1 Rack (eJOI19_rack) C++17
40 / 100
0 ms 408 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
    ll n,k;
    cin >> k>>n;
    k=min(k,61LL);
    vector<ll>a(k,0);
    n--;
    ll i =0 ;
    while(n>0){
      a[i]=n%2;
      n/=2;
      i++;
    }reverse(a.begin(),a.end());
    ll x = 0;
    ll act = 1;
    for(ll i=0;i<a.size();i++){
      if(a[i]!=0)x+=act*a[i];
      act*=2;
    }cout << x+1 << endl;
  
  return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:21:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(ll i=0;i<a.size();i++){
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 408 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 408 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -