# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
272830 | 2020-08-18T15:56:46 Z | EJOI2019Andrew | Rack (eJOI19_rack) | C++14 | 1 ms | 288 KB |
#include<bits/stdc++.h> using namespace std; string ans; map<int,int>freq; long long int MOD=1000000007; void rack(long long int k) { if(k==1&&freq[k]>1) return; if(k%2) ans+='L'; else ans+='R'; int fn(0); if(k%2) fn=1; k/=2; k+=fn; ++freq[k]; rack(k); } long long int solve(long long int n) { long long int l(1),r(pow(2,n)); for(int i=0; i<ans.length(); ++i) { long long int mid=(l+r)/2; if(ans[i]=='R') l=mid+1; else r=mid-1; l%=MOD; r%=MOD; } return l; } int main() { long long int n,k; cin>>n>>k; rack(k); cout<<solve(n); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 288 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 | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 288 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 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 | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 288 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 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 | Incorrect | 0 ms | 256 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |