Submission #1111858

#TimeUsernameProblemLanguageResultExecution timeMemory
1111858vjudge1Rack (eJOI19_rack)C++17
0 / 100
101 ms102400 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define F first #define S second #define all(v) v.begin(),v.end() typedef vector<int> vi; typedef vector<char> vc; typedef pair<int,int> ii; typedef vector<ii> vii; typedef set<int> si; typedef map<int,int> mii; const int INF = 2e5 + 100; int cal(int s,int e,int k){ //cout << s << " " << e << " " << k << endl; if (k == 1) return s; int m = (e - s + 1) / 2; if (k%2 == 1){ cal(s,s + m -1, (k+1) / 2); } else cal(s + m,e , (k+1) / 2); } int32_t main(){ //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL); int n,k; cin >> n >> k; cout << cal(1,(1 << n),k); return 0; }

Compilation message (stderr)

rack.cpp: In function 'long long int cal(long long int, long long int, long long int)':
rack.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...