Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Tested by zydhanlinnar11 on May 28, 2022
- #include <iostream>
- #include <cassert>
- using namespace std;
- void gen(int l, int r) {
- if(l > r) return;
- int mid = l + (r - l) / 2;
- cout<<mid<<" ";
- gen(l, mid - 1); gen(mid + 1, r);
- }
- int main() {
- #ifdef ZYD_WSL
- freopen("/home/zydhanlinnar11/prakfinal-qa/in", "r", stdin);
- #endif
- int n; cin>>n;
- assert(1 <= n && n <= (int)1e5);
- gen(1, n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement