제출 #261458

#제출 시각아이디문제언어결과실행 시간메모리
261458EJOI2019AndrewRack (eJOI19_rack)C++14
40 / 100
1 ms256 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

rack.cpp: In function 'long long int solve(long long int)':
rack.cpp:25:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int i=0; i<ans.length(); ++i)
              ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...