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;
int n, m;
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
int j=m;
int i=n-1;
int k=0;
while(i>=0){
while(i+(1<<k)<j) k++;
for(int p=j; p<=i+(1<<k); p++){
cout << p-(1<<k) << " " << p << "\n";
}
int d=i+(1<<k)-j+1;
j+=d;
i-=d;
}
}
# | 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... |