Submission #577192

# Submission time Handle Problem Language Result Execution time Memory
577192 2022-06-14T08:58:38 Z berr XORanges (eJOI19_xoranges) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod=1e9+7;

int poww(int a, int b)
{
    if(b==0) return 1;
    
    int tmp=poww(a, b/2);

    if(b%2==0) return (tmp*tmp)%mod;
    else return (((tmp*tmp)%mod)*a)%mod;
}


int sum(int a, int b)
{
    return ((((a+b)%mod)+mod)%mod);
}

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);

    int n, k; cin>>n>>k;

    n--;
    int ans=1;
    while(n>=0)
    {
        if(k%2==0) ans=sum(ans, poww(2, n)), k/=2;
        else k++, k/=2;
        n--;
    }

    cout<<ans;   

  

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