Submission #1584192


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 1e9;
 
const int MAX_LOG_V = 30;
int dp[MAX_LOG_V][100001];


int main(){
    int n, m, d;
    cin >> n >> m >> d;
 
    for (int i=0; i<100001; i++) {
        dp[0][i] = i;
    }
    vector<int> v;
    for (int i=0; i<m; i++) {
        int a;
        cin >> a;
        a--;
        v.push_back(a);
    }
    for (int i=v.size()-1; i>=0; i--) {
        swap(dp[0][v[i]], dp[0][v[i]+1]);
    }
 
    for (int i=0; i<MAX_LOG_V-1; i++) {
        for (int j=0; j<n; j++) {
            dp[i+1][j] = dp[i][dp[i][j]];
        }
    }
 
    for (int i=0; i<n; i++) {
        int d_ = d;
        int now = i;
        int j = 0;
        do {
            if (d_ & 1) {
                now = dp[j][now];
            }
            d_ >>= 1;
            j++;
        } while (d_ != 0);
 
        cout << now + 1 << endl;
    }
}

Submission Info

Submission Time
Task D - 阿弥陀
User jack
Language C++14 (GCC 5.4.1)
Score 100
Code Size 946 Byte
Status AC
Exec Time 223 ms
Memory 13428 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 216 ms 13428 KB
01_random01.txt AC 3 ms 8832 KB
01_random02.txt AC 3 ms 8832 KB
01_random03.txt AC 3 ms 8832 KB
01_random04.txt AC 10 ms 9088 KB
01_random05.txt AC 171 ms 12800 KB
01_random06.txt AC 202 ms 13300 KB
01_random07.txt AC 214 ms 13428 KB
02_i.txt AC 5 ms 8960 KB
02_p.txt AC 5 ms 8832 KB
02_random01.txt AC 3 ms 8832 KB
02_random02.txt AC 3 ms 8832 KB
02_random03.txt AC 5 ms 8960 KB
02_random04.txt AC 5 ms 8832 KB
02_random05.txt AC 9 ms 9088 KB
02_random06.txt AC 26 ms 9464 KB
02_random07.txt AC 47 ms 9844 KB
02_random08.txt AC 47 ms 9844 KB
02_rp01.txt AC 5 ms 8832 KB
02_rp02.txt AC 5 ms 8832 KB
02_rp03.txt AC 5 ms 8832 KB
02_rp04.txt AC 5 ms 8832 KB
02_rp05.txt AC 5 ms 8832 KB
03_i.txt AC 3 ms 8832 KB
03_random01.txt AC 6 ms 9088 KB
03_random02.txt AC 33 ms 9716 KB
03_random03.txt AC 28 ms 9588 KB
03_random04.txt AC 28 ms 9588 KB
03_random05.txt AC 8 ms 9088 KB
03_random06.txt AC 7 ms 9088 KB
03_random07.txt AC 10 ms 9212 KB
03_random08.txt AC 3 ms 8832 KB
03_random09.txt AC 12 ms 9212 KB
03_random10.txt AC 19 ms 9336 KB
03_random11.txt AC 32 ms 9716 KB
03_random12.txt AC 33 ms 9716 KB
03_random13.txt AC 26 ms 9588 KB
03_random14.txt AC 21 ms 9464 KB
03_random15.txt AC 10 ms 9212 KB
04_i.txt AC 223 ms 13428 KB
04_p1.txt AC 193 ms 13048 KB
04_p2.txt AC 153 ms 12280 KB
04_random01.txt AC 122 ms 11384 KB
04_random02.txt AC 89 ms 10748 KB
04_random03.txt AC 45 ms 9720 KB
04_random04.txt AC 62 ms 9972 KB
04_random05.txt AC 63 ms 10100 KB
04_random06.txt AC 124 ms 11512 KB
04_random07.txt AC 113 ms 10996 KB
04_random08.txt AC 96 ms 10740 KB
04_random09.txt AC 82 ms 10356 KB
04_random10.txt AC 118 ms 11516 KB
04_random11.txt AC 222 ms 13428 KB
04_random12.txt AC 220 ms 13428 KB
04_random13.txt AC 221 ms 13428 KB
04_rp01.txt AC 192 ms 13048 KB
04_rp02.txt AC 192 ms 13048 KB
04_rp03.txt AC 196 ms 13048 KB
04_rp04.txt AC 195 ms 13048 KB
04_rp05.txt AC 194 ms 13048 KB
04_rp06.txt AC 198 ms 13048 KB
04_rp07.txt AC 191 ms 13048 KB
04_rp08.txt AC 193 ms 13048 KB
04_rp09.txt AC 193 ms 13048 KB
04_rp10.txt AC 194 ms 13048 KB
sample_1.txt AC 3 ms 8832 KB
sample_2.txt AC 3 ms 8832 KB
sample_3.txt AC 3 ms 8832 KB