Submission #1590644


Source Code Expand

#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) for(ll i=1;i<=(n);i++)
#define MOD 1000000007
#define int long long
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1e9;
const ll LLINF = LLONG_MAX / 10;

vector<int> join(vector<int> amida1, vector<int> amida2)
{
    int n = amida1.size();

    vector<int> ret(n);
    REP(i,n) {
        ret[i] = amida1[amida2[i]-1];
    }

    return ret;
}

vector<int> amida_pow(vector<int> amida, int n)
{
    vector<int> res = amida;
    while (n > 0) {
        if (n & 1) res = join(res, amida);
        amida = join(amida, amida);
        n >>= 1;
    }
    return res;
}

int N, M, D;
vector<int> amida;
int A;

signed main()
{
    cin >> N >> M >> D;
    REP(i,N) {
        amida.push_back(i + 1);
    }
    REP(i,M) {
        cin >> A;
        swap(amida[A-1], amida[A]);
    }

    //REP(i,amida.size()) cout << amida[i] << " ";
    //cout << endl << endl;

    vector<int> ans = amida_pow(amida, D - 1);
    //REP(i,ans.size()) cout << ans[i] << endl;

    pair<int, int> pii[101010];
    REP(i,ans.size()) pii[i] = make_pair(ans[i], i + 1);
    sort(pii, pii + ans.size());
    REP(i,ans.size()) cout << pii[i].second << endl;
}

Submission Info

Submission Time
Task D - 阿弥陀
User hiyokko3
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1484 Byte
Status AC
Exec Time 231 ms
Memory 7148 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 209 ms 4068 KB
01_random01.txt AC 2 ms 1792 KB
01_random02.txt AC 2 ms 1792 KB
01_random03.txt AC 2 ms 1792 KB
01_random04.txt AC 9 ms 1920 KB
01_random05.txt AC 165 ms 4068 KB
01_random06.txt AC 197 ms 4068 KB
01_random07.txt AC 208 ms 4068 KB
02_i.txt AC 4 ms 1920 KB
02_p.txt AC 4 ms 1920 KB
02_random01.txt AC 2 ms 1792 KB
02_random02.txt AC 2 ms 1792 KB
02_random03.txt AC 4 ms 1920 KB
02_random04.txt AC 3 ms 1920 KB
02_random05.txt AC 8 ms 1920 KB
02_random06.txt AC 24 ms 1920 KB
02_random07.txt AC 45 ms 1920 KB
02_random08.txt AC 45 ms 1920 KB
02_rp01.txt AC 4 ms 1920 KB
02_rp02.txt AC 4 ms 1920 KB
02_rp03.txt AC 4 ms 1920 KB
02_rp04.txt AC 4 ms 1920 KB
02_rp05.txt AC 4 ms 1920 KB
03_i.txt AC 2 ms 1792 KB
03_random01.txt AC 4 ms 1792 KB
03_random02.txt AC 30 ms 1792 KB
03_random03.txt AC 26 ms 1792 KB
03_random04.txt AC 25 ms 1792 KB
03_random05.txt AC 6 ms 1792 KB
03_random06.txt AC 6 ms 1792 KB
03_random07.txt AC 9 ms 1792 KB
03_random08.txt AC 2 ms 1792 KB
03_random09.txt AC 10 ms 1792 KB
03_random10.txt AC 17 ms 1792 KB
03_random11.txt AC 29 ms 1792 KB
03_random12.txt AC 30 ms 1792 KB
03_random13.txt AC 24 ms 1792 KB
03_random14.txt AC 20 ms 1792 KB
03_random15.txt AC 9 ms 1792 KB
04_i.txt AC 225 ms 7064 KB
04_p1.txt AC 201 ms 5592 KB
04_p2.txt AC 158 ms 6024 KB
04_random01.txt AC 123 ms 3576 KB
04_random02.txt AC 91 ms 3280 KB
04_random03.txt AC 43 ms 2360 KB
04_random04.txt AC 61 ms 2288 KB
04_random05.txt AC 63 ms 2524 KB
04_random06.txt AC 131 ms 4136 KB
04_random07.txt AC 114 ms 3700 KB
04_random08.txt AC 97 ms 2856 KB
04_random09.txt AC 80 ms 2676 KB
04_random10.txt AC 122 ms 4316 KB
04_random11.txt AC 228 ms 7148 KB
04_random12.txt AC 228 ms 7092 KB
04_random13.txt AC 231 ms 5584 KB
04_rp01.txt AC 205 ms 5108 KB
04_rp02.txt AC 203 ms 7092 KB
04_rp03.txt AC 204 ms 5628 KB
04_rp04.txt AC 200 ms 5684 KB
04_rp05.txt AC 205 ms 7064 KB
04_rp06.txt AC 204 ms 7136 KB
04_rp07.txt AC 202 ms 5628 KB
04_rp08.txt AC 200 ms 7092 KB
04_rp09.txt AC 213 ms 5672 KB
04_rp10.txt AC 210 ms 7108 KB
sample_1.txt AC 2 ms 1792 KB
sample_2.txt AC 2 ms 1792 KB
sample_3.txt AC 2 ms 1792 KB