Submission #314392

# Submission time Handle Problem Language Result Execution time Memory
314392 2020-10-19T19:11:15 Z urosk Rack (eJOI19_rack) C++14
100 / 100
135 ms 376 KB
#include <bits/stdc++.h>
#include <chrono>
#define ll long long
#define ull unsigned long long
#define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inf 1e15
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
using namespace std;
using namespace std::chrono;
/*auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cout << "Time taken by function: "
         << duration.count() << " microseconds" << endl;*/
ll mod = 1e9+7;
int main(){

    int n;
    ll k;
    cin >> n >> k;
    ll ans = 0;
    ll g;
    for(int i = n;i>=1;i--){
        if(k%2==0){
            g = 1;
            for(int j = 0;j<i-1;j++){
                g*=2;
                g%=mod;
            }
            ans+=g;
            ans%=mod;
        }
        k=(k+1)/2;
    }
    ans++;
    ans%=mod;
    cout<<ans;
}

Compilation message

rack.cpp:5:9: warning: ISO C++11 requires whitespace after the macro name
    5 | #define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |         ^~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 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 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 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 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 10 ms 256 KB Output is correct
15 Correct 135 ms 376 KB Output is correct