Submission #8146281


Source Code Expand

Copy
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

ll R[31][101010];
ll tmp[101010];
int main(){

    ll N, M, D;
    cin >> N >> M >> D;
    rep1(i, N)tmp[i] = i;
    rep1(i, M){
        ll a;
        cin >> a;
        swap(tmp[a], tmp[a + 1]);
    }
    rep1(i, N)R[0][tmp[i]] = i;
    rep1(i, 30)rep1(j, N)R[i][j] = R[i - 1][R[i - 1][j]];
    rep1(i, N){
        ll pos = i;
        for(ll i = 0; i < 30; i++){
            if((D & (1 << i)) == 0)continue;
            pos = R[i][pos];
        }
        cout << pos << endl;
    }

    return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User kagasan
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1033 Byte
Status AC
Exec Time 227 ms
Memory 26620 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 227 ms 26620 KB
01_random01.txt AC 5 ms 22784 KB
01_random02.txt AC 6 ms 22784 KB
01_random03.txt AC 5 ms 22784 KB
01_random04.txt AC 13 ms 22912 KB
01_random05.txt AC 170 ms 26112 KB
01_random06.txt AC 205 ms 26112 KB
01_random07.txt AC 219 ms 26112 KB
02_i.txt AC 7 ms 22784 KB
02_p.txt AC 7 ms 22784 KB
02_random01.txt AC 6 ms 22784 KB
02_random02.txt AC 5 ms 22784 KB
02_random03.txt AC 8 ms 22784 KB
02_random04.txt AC 7 ms 22784 KB
02_random05.txt AC 11 ms 22784 KB
02_random06.txt AC 28 ms 22784 KB
02_random07.txt AC 48 ms 22784 KB
02_random08.txt AC 48 ms 22784 KB
02_rp01.txt AC 7 ms 22784 KB
02_rp02.txt AC 7 ms 22784 KB
02_rp03.txt AC 7 ms 22784 KB
02_rp04.txt AC 7 ms 22784 KB
02_rp05.txt AC 7 ms 22784 KB
03_i.txt AC 5 ms 22784 KB
03_random01.txt AC 8 ms 22784 KB
03_random02.txt AC 34 ms 22784 KB
03_random03.txt AC 29 ms 22784 KB
03_random04.txt AC 29 ms 22784 KB
03_random05.txt AC 10 ms 22784 KB
03_random06.txt AC 10 ms 22784 KB
03_random07.txt AC 12 ms 22784 KB
03_random08.txt AC 6 ms 22784 KB
03_random09.txt AC 14 ms 22784 KB
03_random10.txt AC 21 ms 22784 KB
03_random11.txt AC 33 ms 22784 KB
03_random12.txt AC 34 ms 22784 KB
03_random13.txt AC 27 ms 22784 KB
03_random14.txt AC 23 ms 22784 KB
03_random15.txt AC 12 ms 22784 KB
04_i.txt AC 223 ms 26112 KB
04_p1.txt AC 194 ms 25984 KB
04_p2.txt AC 156 ms 25472 KB
04_random01.txt AC 123 ms 24704 KB
04_random02.txt AC 91 ms 24320 KB
04_random03.txt AC 47 ms 23040 KB
04_random04.txt AC 63 ms 23040 KB
04_random05.txt AC 64 ms 23168 KB
04_random06.txt AC 126 ms 24832 KB
04_random07.txt AC 112 ms 23936 KB
04_random08.txt AC 97 ms 23808 KB
04_random09.txt AC 82 ms 23296 KB
04_random10.txt AC 122 ms 24960 KB
04_random11.txt AC 222 ms 26112 KB
04_random12.txt AC 220 ms 26112 KB
04_random13.txt AC 224 ms 26112 KB
04_rp01.txt AC 196 ms 26112 KB
04_rp02.txt AC 194 ms 26112 KB
04_rp03.txt AC 192 ms 26112 KB
04_rp04.txt AC 193 ms 26112 KB
04_rp05.txt AC 195 ms 26112 KB
04_rp06.txt AC 197 ms 26112 KB
04_rp07.txt AC 197 ms 26112 KB
04_rp08.txt AC 197 ms 26112 KB
04_rp09.txt AC 198 ms 26112 KB
04_rp10.txt AC 196 ms 26112 KB
sample_1.txt AC 5 ms 22784 KB
sample_2.txt AC 5 ms 22784 KB
sample_3.txt AC 5 ms 22784 KB