# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
840855 | 2023-08-31T18:56:09 Z | raul2008487 | Rack (eJOI19_rack) | C++17 | 3 ms | 3500 KB |
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define ll long long #define vl vector<ll> #define endl "\n" #define all(v) v.begin(), v.end() using namespace std; const int sz = 2e5+5; const ll inf = 100000000000000005; const int mod = 1e9+7; ll tp[sz]; ll rec(ll k, ll n){ if(n==0){ return k; } ll lc = k/2 + k%2; ll rc = k/2; if(lc == rc){ return (tp[n-1] + rec(rc, n-1))%mod; } return rec(lc,n-1); } void solve(){ ll n,k,i,j; cin>>n>>k; tp[0] = 1; for(i=1;i<=n;i++){ tp[i] = tp[i-1] * 2; tp[i] %= mod; } cout << rec(k, n) << endl; } int main(){ ll t=1; //cin>>t; while(t--){ solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 724 KB | Output is correct |
15 | Runtime error | 3 ms | 3500 KB | Execution killed with signal 11 |
16 | Halted | 0 ms | 0 KB | - |