Submission #912373

# Submission time Handle Problem Language Result Execution time Memory
912373 2024-01-19T10:38:30 Z huyngo Permutation (APIO22_perm) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>  
#include "perm.h"
using namespace std;
using ll = long long;
using i64 = long long;
void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cerr << x; } void __print(double x) { cerr << x; } void __print(long double x) { cerr << x; } void __print(char x) { cerr << '\'' << x << '\''; } void __print(const char* x) { cerr << '"' << x << '"'; } void __print(const string& x) { cerr << '"' << x << '"'; } void __print(bool x) { cerr << (x ? "true" : "false"); } template<typename T, typename V> void __print(const pair<T, V>& x) { cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}'; } template<typename T> void __print(const T& x) { int f = 0; cerr << '{'; for (auto& i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}"; } void _print() { cerr << "]\n"; } template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#define ln "\n"
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a; i<=b; ++i)
#define ar array
int Bit(int mask, int b) { return (mask >> b) & 1; }
const ll base = 311, MOD = 998244353, M = 1e9 + 7, INF = 1e18;

const int mxN = 1e6 + 5;
int n;

vector<int> construct_permutation(long long X) {
    vector<int> ans;
    int l = 0, r = 0;
    auto work = [&](auto self, i64 x) ->void {
        if (x == 0) return;
        if (x & 1) {
            ans.push_back(--l);
            self(self, x - 1);
        }
        else {
            ans.push_back(++r);
            self(self, x >> 1);
        }
        };
    work(work, X);
    int mn = *min_element(all(ans));
    for (int& i : ans)
        i -= mn;
    return ans;
}

int32_t main() {
    fast_cin();
    auto v = construct_permutation(5);
    dbg(v);
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccZg7smk.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccUjjX4k.o:perm.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status