Submission #497536

# Submission time Handle Problem Language Result Execution time Memory
497536 2021-12-23T08:20:18 Z Karabasan Rack (eJOI19_rack) C++17
100 / 100
12 ms 15696 KB
#include <bits/stdc++.h>
#define ll long long
#define fast1 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define int long long
#define mod 1000000007
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,avx")
#pragma GCC optimize("unroll-loops")

int n,k;
vector<int> v;
int dizi[1000006];
void solve()
{
    cin>>n>>k;
    k--;
    dizi[0]=1;
    for(int i=1;i<=1000000;i++)
        dizi[i]=(dizi[i-1]*2)%mod;
    int cvp[n+5]={};
    int p=1;
    while(k)
    {
        cvp[p]=(k%2);
        k/=2;
        p++;
    }

    int cevap=0;
    for(int i=n;i>=1;i--)
    {
        if(cvp[i])
            cevap=(cevap+dizi[n-i])%mod;
    }
    cout<<(cevap+1)%mod;
}
signed main()
{
    //fast1
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 8104 KB Output is correct
2 Correct 8 ms 8100 KB Output is correct
3 Correct 8 ms 8100 KB Output is correct
4 Correct 7 ms 8012 KB Output is correct
5 Correct 8 ms 8116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 8104 KB Output is correct
2 Correct 8 ms 8100 KB Output is correct
3 Correct 8 ms 8100 KB Output is correct
4 Correct 7 ms 8012 KB Output is correct
5 Correct 8 ms 8116 KB Output is correct
6 Correct 7 ms 8024 KB Output is correct
7 Correct 7 ms 8012 KB Output is correct
8 Correct 7 ms 8012 KB Output is correct
9 Correct 8 ms 8056 KB Output is correct
10 Correct 7 ms 8108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 8104 KB Output is correct
2 Correct 8 ms 8100 KB Output is correct
3 Correct 8 ms 8100 KB Output is correct
4 Correct 7 ms 8012 KB Output is correct
5 Correct 8 ms 8116 KB Output is correct
6 Correct 7 ms 8024 KB Output is correct
7 Correct 7 ms 8012 KB Output is correct
8 Correct 7 ms 8012 KB Output is correct
9 Correct 8 ms 8056 KB Output is correct
10 Correct 7 ms 8108 KB Output is correct
11 Correct 7 ms 8036 KB Output is correct
12 Correct 8 ms 8044 KB Output is correct
13 Correct 7 ms 8108 KB Output is correct
14 Correct 9 ms 8528 KB Output is correct
15 Correct 12 ms 15696 KB Output is correct