Submission #748335

#TimeUsernameProblemLanguageResultExecution timeMemory
748335TrunktySob (COCI19_sob)C++14
39 / 110
56 ms18172 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll int n,m,l,r,curr; vector<vector<int>> ans; signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; l = m; r = m+n-1; for(int j=30;j>=0;j--){ if(n&(1<<j)){ if(l&(1<<j)){ for(int i=r;i>r-(1<<j);i--){ ans.push_back({i%(1<<j)+curr,i}); } r -= (1<<j); } else{ for(int i=l;i<l+(1<<j);i++){ ans.push_back({i%(1<<j)+curr,i}); } l += (1<<j); } curr += (1<<j); } } for(vector<int> i:ans){ cout << i[0] << " " << i[1] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...