Submission #272827

#TimeUsernameProblemLanguageResultExecution timeMemory
272827EJOI2019AndrewRack (eJOI19_rack)C++14
0 / 100
0 ms256 KiB
#include<bits/stdc++.h> using namespace std; #define MOD 1000000007 string s; map<long long int,int>freq; void rack(long long int k) { if(freq[k]>1&&k==1) return; if(k%2) s+='L'; else s+='R'; int fr(k%2); k/=2; k+=fr; ++freq[k]; rack(k); } long long int sol(long long int n) { long long int l(0),r(pow(2,n)); for(int i=0; i<s.length(); ++i) { long long int mid=(l+r)/2; if(s[i]=='L') r=mid-1; else l=mid+1; } return l%MOD; } int main() { //EWEX //SXSN //WSEX long long int n,k; cin>>n>>k; rack(k); cout<<sol(n); }

Compilation message (stderr)

rack.cpp: In function 'long long int sol(long long int)':
rack.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 | for(int i=0; i<s.length(); ++i)
      |              ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...