Submission #980059


Source Code Expand

#include <algorithm>//min/max/sort(rand-access it)/merge
#include <array>
#include <bitset>
// #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration
#include <climits>//INT_MAX/INT_MIN/ULLONG_MAX
#include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc
#include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort
// #include <fstream>//ifstream/ofstream
#include <iomanip>//setfill/setw/setprecision/fixed/scientific
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <iterator>
#include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN
#include <list>
#include <queue>
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <tuple>
#include <utility>//pair
#include <valarray>
#include <vector>

#define PRIME_SHORT 10007
#define PRIME 1000000007

using namespace std;

typedef unsigned int ui;
typedef unsigned long ul;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<ull, int> puli;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pllll;
typedef pair<ull, ull> pulul;
typedef pair<double, double> pdd;
typedef tuple<int, int, int> ti3;
typedef tuple<int, int, int, int> ti4;

const bool debug = false;

template<typename T> T* rar(size_t n);
template<typename T> T** rar2(size_t n, size_t m);

template<typename T> T ipow(T base, T exp);

inline size_t left(size_t current, bool swap = false);
inline size_t right(size_t current, bool swap = false);

template<typename T> inline T griddist(T x, T y, T s, T t);
template<typename T> inline T griddist(pair<T, T> one, pair<T, T> two);
template<typename T> inline T griddist(tuple<T, T> one, tuple<T, T> two);

template<typename T> inline T sqeucldist(T x, T y, T s, T t);
template<typename T> inline T sqeucldist(pair<T, T> one, pair<T, T> two);
template<typename T> inline T sqeucldist(tuple<T, T> one, tuple<T, T> two);

inline ull modadd(ull a, ull b, int mod);
inline ull modmult(ull a, ull b, int mod);

int main(void) {
    size_t n;
    cin >> n;
    size_t* p = rar<size_t>(n);
    ui* a = new ui[n];
    ui* b = new ui[n];
    for (size_t i = 0; i < n; ++i) {
        a[i] = 30000*i + 1;
        b[i] = 30000*(n-i) - 1;
    }
    for (size_t i = 0; i < n; ++i) {
        --p[i];
        a[p[i]] += i;
        b[p[i]] += i;
    }
    for (size_t i = 0; i < n; ++i) {
        cout << a[i] << ' ';
    } cout << '\n';
    for (size_t i = 0; i < n; ++i) {
        cout << b[i] << ' ';
    } cout << endl;

    //debug output
    if (debug)
    {
        //1D
        cout << "p" << endl;
        for (size_t i = 0; i < n; ++i)
        {
            cout << p[i] << "\t";
        }
    }

    return 0;
}

template<typename T>
T* rar(size_t n) {
    T* a = new T[n];
    for (size_t i = 0; i < n; ++i) cin >> a[i];
    return a;
}

template<typename T>
T** rar2(size_t n, size_t m) {
    T** a = new T*[n];
    for (size_t i = 0; i < n; ++i) {
        a[i] = new T[m];
        for (size_t j = 0; j < m; ++j) cin >> a[i][j];
    } return a;
}

template<typename T>
T ipow(T base, T exp) {
    T result = 1;
    while (exp) {
        if (exp & 1) result *= base;
        exp >>= 1;
        base *= base;
    }
    return result;
}

inline size_t left(size_t current, bool swap) {
    return swap ? right(current) : 2*current+1;
}
inline size_t right(size_t current, bool swap) {
    return swap ? left(current) : 2*(current+1);
}

template<typename T>
inline T griddist(T x, T y, T s, T t) {
    return abs(x-s) + abs(y-t);
}
template<typename T>
inline T griddist(pair<T, T> one, pair<T, T> two) {
    return abs(one.first - two.first) + abs(one.second - two.second);
}
template<typename T>
inline T griddist(tuple<T, T> one, tuple<T, T> two) {
    return abs(get<0>(one) - get<0>(two)) + abs(get<1>(one) - get<1>(two));
}

template<typename T>
inline T sqeucldist(T x, T y, T s, T t) {
    T a = x-s;
    T b = y-t;
    return a*a+b*b;
}
template<typename T>
inline T sqeucldist(pair<T, T> one, pair<T, T> two) {
    T a = one.first - two.first;
    T b = one.second - two.second;
    return a*a+b*b;
}
template<typename T>
inline T sqeucldist(tuple<T, T> one, tuple<T, T> two) {
    T a = get<0>(one) - get<0>(two);
    T b = get<1>(one) - get<1>(two);
    return a*a+b*b;
}

inline ull modadd(ull a, ull b, int mod) {
    return ((a%mod) + (b%mod))%mod;
}
inline ull modmult(ull a, ull b, int mod) {
    return ((a%mod)*(b%mod))%mod;
}

Submission Info

Submission Time
Task B - Construct Sequences
User L3Sota
Language C++14 (GCC 5.4.1)
Score 400
Code Size 4784 Byte
Status AC
Exec Time 12 ms
Memory 896 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 22
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 3 ms 256 KB
001.txt AC 3 ms 256 KB
002.txt AC 3 ms 256 KB
003.txt AC 3 ms 256 KB
004.txt AC 3 ms 256 KB
005.txt AC 12 ms 896 KB
006.txt AC 4 ms 384 KB
007.txt AC 11 ms 896 KB
008.txt AC 7 ms 640 KB
009.txt AC 12 ms 896 KB
010.txt AC 12 ms 896 KB
011.txt AC 12 ms 896 KB
012.txt AC 12 ms 896 KB
013.txt AC 12 ms 896 KB
014.txt AC 12 ms 896 KB
015.txt AC 12 ms 896 KB
016.txt AC 12 ms 896 KB
017.txt AC 12 ms 896 KB
018.txt AC 12 ms 896 KB
example0.txt AC 3 ms 256 KB
example1.txt AC 2 ms 256 KB
example2.txt AC 3 ms 256 KB