Submission #1097239

# Submission time Handle Problem Language Result Execution time Memory
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++){
      |                ~^~~~~~~~~
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 -