Submission #1113345


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

vector<ll> sigma(const vector<ll>& a, const vector<ll>& b) {
    assert(a.size() == b.size());
    vector<ll> res(a.size());
    REP(i, a.size()) {
        res[i] = a[b[i]];
    }
    return res;
}
vector<ll> power(vector<ll> x, ll n) {
    vector<ll> res(x.size());
    REP(i, res.size()) res[i] = i;
    for (ll i = 1; i <= n; i <<= 1) {
        if (i & n) res = sigma(res, x);
        x = sigma(x, x);
    }
    return res;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n, m, D; cin >> n >> m >> D;
    vector<ll> A(m); cin >> A;
    REP(i, m) A[i]--;
    vector<ll> s(n);
    REP(i, n) s[i] = i;
    REP(i, m) {
        swap(s[A[i]], s[A[i]+1]);
    }
    vector<ll> a = power(s, D);
    vector<ll> ans(n, -1);
    REP(i, n) {
        ans[a[i]] = i;
    }
    REP(i, n) {
        cout << ans[i]+1 << endl;
    }
}

Submission Info

Submission Time
Task D - 阿弥陀
User drafear
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1958 Byte
Status AC
Exec Time 182 ms
Memory 5584 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 10 / 10 20 / 20 20 / 20 50 / 50
Status
AC × 9
AC × 18
AC × 18
AC × 29
Set Name Test Cases
Subtask1 sample_1.txt, 01_i.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_i.txt, 02_p.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_rp01.txt, 02_rp02.txt, 02_rp03.txt, 02_rp04.txt, 02_rp05.txt
Subtask3 sample_1.txt, sample_2.txt, 03_i.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt
Subtask4 sample_1.txt, sample_2.txt, sample_3.txt, 04_i.txt, 04_p1.txt, 04_p2.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt, 04_random06.txt, 04_random07.txt, 04_random08.txt, 04_random09.txt, 04_random10.txt, 04_random11.txt, 04_random12.txt, 04_random13.txt, 04_rp01.txt, 04_rp02.txt, 04_rp03.txt, 04_rp04.txt, 04_rp05.txt, 04_rp06.txt, 04_rp07.txt, 04_rp08.txt, 04_rp09.txt, 04_rp10.txt
Case Name Status Exec Time Memory
01_i.txt AC 178 ms 4992 KB
01_random01.txt AC 1 ms 256 KB
01_random02.txt AC 1 ms 256 KB
01_random03.txt AC 1 ms 256 KB
01_random04.txt AC 7 ms 512 KB
01_random05.txt AC 158 ms 3696 KB
01_random06.txt AC 165 ms 4608 KB
01_random07.txt AC 171 ms 4992 KB
02_i.txt AC 3 ms 256 KB
02_p.txt AC 3 ms 256 KB
02_random01.txt AC 1 ms 256 KB
02_random02.txt AC 1 ms 256 KB
02_random03.txt AC 3 ms 384 KB
02_random04.txt AC 3 ms 256 KB
02_random05.txt AC 4 ms 512 KB
02_random06.txt AC 10 ms 1024 KB
02_random07.txt AC 17 ms 1920 KB
02_random08.txt AC 16 ms 1920 KB
02_rp01.txt AC 3 ms 256 KB
02_rp02.txt AC 3 ms 256 KB
02_rp03.txt AC 3 ms 256 KB
02_rp04.txt AC 3 ms 256 KB
02_rp05.txt AC 3 ms 256 KB
03_i.txt AC 1 ms 256 KB
03_random01.txt AC 2 ms 384 KB
03_random02.txt AC 12 ms 1792 KB
03_random03.txt AC 10 ms 1536 KB
03_random04.txt AC 10 ms 1536 KB
03_random05.txt AC 3 ms 512 KB
03_random06.txt AC 3 ms 512 KB
03_random07.txt AC 4 ms 640 KB
03_random08.txt AC 1 ms 256 KB
03_random09.txt AC 5 ms 768 KB
03_random10.txt AC 7 ms 1024 KB
03_random11.txt AC 12 ms 1664 KB
03_random12.txt AC 12 ms 1792 KB
03_random13.txt AC 10 ms 1408 KB
03_random14.txt AC 8 ms 1152 KB
03_random15.txt AC 4 ms 640 KB
04_i.txt AC 182 ms 5584 KB
04_p1.txt AC 170 ms 4700 KB
04_p2.txt AC 135 ms 3772 KB
04_random01.txt AC 99 ms 3056 KB
04_random02.txt AC 76 ms 2284 KB
04_random03.txt AC 25 ms 1408 KB
04_random04.txt AC 29 ms 2048 KB
04_random05.txt AC 35 ms 1920 KB
04_random06.txt AC 108 ms 3192 KB
04_random07.txt AC 73 ms 3140 KB
04_random08.txt AC 63 ms 2620 KB
04_random09.txt AC 45 ms 2304 KB
04_random10.txt AC 102 ms 2924 KB
04_random11.txt AC 178 ms 4992 KB
04_random12.txt AC 180 ms 4992 KB
04_random13.txt AC 176 ms 4992 KB
04_rp01.txt AC 170 ms 4224 KB
04_rp02.txt AC 168 ms 4688 KB
04_rp03.txt AC 171 ms 4688 KB
04_rp04.txt AC 171 ms 4688 KB
04_rp05.txt AC 169 ms 4688 KB
04_rp06.txt AC 174 ms 4688 KB
04_rp07.txt AC 167 ms 4688 KB
04_rp08.txt AC 169 ms 4224 KB
04_rp09.txt AC 171 ms 4224 KB
04_rp10.txt AC 170 ms 4688 KB
sample_1.txt AC 1 ms 256 KB
sample_2.txt AC 1 ms 256 KB
sample_3.txt AC 1 ms 256 KB