Submission #368268

# Submission time Handle Problem Language Result Execution time Memory
368268 2021-02-19T21:06:46 Z iliccmarko Rack (eJOI19_rack) C++14
0 / 100
10 ms 8172 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define input(n, v) {for(int i = 0;i<n;i++) cin>>v[i];}
#define output(n, v) {for(int i = 0;i<n;i++) cout<<v[i]<<" "; cout<<endl;}
#define single_case solve();
#define line cout<<"------------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); }
#define mod 1000000007
const int N = 1e6 + 5;
ll stepen[N];


int main()
{
    stepen[0] = 1LL;
    for(int i = 1;i<N;i++) stepen[i] = (stepen[i-1]*2LL)%mod;
    ios
    ll n, k;
    cin>>n>>k;
    ll s = k/4LL;
    if(k%4LL<2)
    {
        if(k%4LL==1)
        {
            cout<<s + 1;
        }
        else
        {
            cout<<(stepen[n-1]+1+s)%mod;
        }
    }
    else
    {
        if(k%4LL==2)
        {
            //cout<<stepen[n-1]<<" "<<s<<endl;
            ll x = stepen[n-1]-s-1;
            if(x<0) x += mod;
            x%=mod;
            cout<<x;
        }
        else
        {
            ll x = stepen[n]-s-1;
            if(x<0) x += mod;
            if(x>=mod) x%=mod;
            cout<<x;
        }
    }




    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 8172 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 8172 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 8172 KB Output isn't correct
2 Halted 0 ms 0 KB -