This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//!yrt tsuj uoy srettam gnihton no emoc
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
inline void solve(vector <pii> a, vector <pii> b){
if((int)a.size() == 1){
cout << a[0].S << " " << b[0].S << '\n';
return;
}
vector <pii> a1, a2, b1, b2;
for(auto u : a){
if(u.F & 1){
a2.pb({u.F / 2, u.S});
}else{
a1.pb({u.F / 2, u.S});
}
}
if((int)a1.size() != (int)a2.size() && (b[0].F & 1)){
b[0].F --;
}
for(auto u : b){
if(u.F & 1){
b2.pb({u.F / 2, u.S});
}else{
b1.pb({u.F / 2, u.S});
}
}
solve(a1, b1);
solve(a2, b2);
}
int main(){
fast_io;
int n, m;
cin >> n >> m;
vector <pii> a, b;
for(int i = 0; i < n; i ++){
a.pb({i, i});
b.pb({m + i, m + i});
}
solve(a, b);
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... |