답안 #775341

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
775341 2023-07-06T09:51:17 Z vjudge1 Rack (eJOI19_rack) C++17
100 / 100
8 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector <bool> v;

int32_t main(){
    faster
    int n,m;cin>>n>>m;
    m--;
    while(m>0){
        v.push_back(m%2);
        m/=2;
    }
    while(v.size()!=n){
        v.push_back(0);
    }
    reverse(v.begin(),v.end());
    int cev=0,gec=1;
    for(int i=0;i<n;i++){
        if(v[i]){
            cev+=gec;
        }
        gec*=2;
        cev%=mod;
        gec%=mod;
    }
    cout<<(cev+1)%mod<<'\n';
    return 0;
}

Compilation message

rack.cpp: In function 'int32_t main()':
rack.cpp:16:19: warning: comparison of integer expressions of different signedness: 'std::vector<bool>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   16 |     while(v.size()!=n){
      |           ~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 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 316 KB Output is correct
15 Correct 8 ms 468 KB Output is correct