Submission #467344

# Submission time Handle Problem Language Result Execution time Memory
467344 2021-08-22T17:28:40 Z TlenekWodoru Rack (eJOI19_rack) C++14
100 / 100
11 ms 308 KB
#include <bits/stdc++.h>
using namespace std;
unsigned long long mod=1000000007;
int main()
{ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    unsigned long long n,k;cin>>n>>k;
    unsigned long long v=1;
    k--;
    unsigned long long poww=1;
    for(int i=1;i<=n;i++)
    {
        poww=(poww*2)%mod;
        if(k%2==0)
        {
            v=(v*2)%mod;
        }
        else
        {
            v=(v*2+1)%mod;
        }
        k=k/2;
    }
    cout<<((v+mod)-poww+1)%mod<<endl;
    return 0;
}





Compilation message

rack.cpp: In function 'int main()':
rack.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   10 |     for(int i=1;i<=n;i++)
      |                 ~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 11 ms 308 KB Output is correct