This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int N = 1e6 + 6;
int ans[N];
void solve(){
int n,m;
cin >> n >> m;
int lg = __lg(n);
for(int i=m;i<m+n;i++){
int cur = 0;
for(int j=0;j<=lg;j++){
cur ^= (i & (1ll<<j));
}
for(int j=lg;j>=0;j--){
if(cur < n && !ans[cur]){
ans[cur] = i;
break;
}
cur ^= (cur & (1ll<<j));
}
}
for(int i=0;i<n;i++){
cout << i << ' ' << ans[i] << endl;
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
// cin >> t;
while(t--)
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |