Submission #288453

# Submission time Handle Problem Language Result Execution time Memory
288453 2020-09-01T13:52:24 Z topovik Rack (eJOI19_rack) C++14
100 / 100
19 ms 8684 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define INF 1000000000

using namespace std;

typedef long long ll;
typedef long double ld;

const ll oo = 1e9+7;
const ll N = 1e6;

int main()
{
    ll n,k;
    cin>>n>>k;
    vector <ll> steps;
    for (ll i=0; i<n; i++)
    {
        if (!(k&1))
        {
            k>>=1;
            steps.pb(1);
        }
        else {steps.pb(0);k=(k+1)/2;}
    }
    ll ans=0;
    for (ll i=0; i<steps.size(); i++) ans=(ans*2+steps[i])%oo;
    cout<<1+ans;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:31:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for (ll i=0; i<steps.size(); i++) ans=(ans*2+steps[i])%oo;
      |                  ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 2 ms 1020 KB Output is correct
15 Correct 19 ms 8684 KB Output is correct