답안 #763721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
763721 2023-06-22T17:14:43 Z ivopav Rack (eJOI19_rack) C++14
100 / 100
8 ms 468 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    long long int n;
    long long int k;
    cin >> n >> k;
    k-=1ll;
    vector<bool> bin={};
    while (k>0ll){
        bin.push_back(k%2);
        k/=2ll;
    }
    while (bin.size()<n){
        bin.push_back(0ll);
    }
    long long int rje=0ll;
    reverse(bin.begin(),bin.end());
    long long int sad=1ll;
    for (long long int i=0;i<bin.size();i++){
        if (bin[i]){
            rje+=sad;
            rje%=1000000007ll;
        }
        sad*=2ll;
        sad%=1000000007ll;
    }
    cout << (rje+1ll)%1000000007ll << "\n";
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:14:22: warning: comparison of integer expressions of different signedness: 'std::vector<bool>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   14 |     while (bin.size()<n){
      |            ~~~~~~~~~~^~
rack.cpp:20:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (long long int i=0;i<bin.size();i++){
      |                            ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 276 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 276 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 276 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 8 ms 468 KB Output is correct