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;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 vll;
typedef unsigned __int128 uvll;
ll _i=0;
#define ffn(x) _i=x
#define llll pair<ll , ll>
#define stitr set<ll>::iterator
#define fora(y,x) for(ll y=_i;x>y;y++)
#define pb push_back
#define pf push_front
#define debu cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e13 + 7;
const ll ous=1e5 + 5;
const ll dx[4] = {0 , -1 , 1 , 0} , dy[4] = {1,0,0,-1};
ll bt[ous];
void solve(){
ll n , m;cin >> n >> m;
ll z =m+n-1;
vector<ll> dt;
ll y = 1;
for(ll i = 0;28>i;i++ , y*=2){
//cout << y << "\n";
dt.pb(y);
}
y = dt.size();
for(ll i = m;z>=i;i++){
ll o = i;
//cout << o << "\n";
for(ll j = y-1;0<=j && o>=0;j--){
bt[o] = i;
if(o >= dt[j]){
o-=dt[j];
}
//cout << o << "\n";
}
}
bt[0] = m;
fora(i,n){
cout << i << " " << bt[i] << "\n";
}
return;/**/
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
ll 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... |