AtCoder Beginner Contest 013

Submission #7470726

Source codeソースコード

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n,m,d;
    cin>>n>>m>>d;
    vector<int> vec(n);
    rep(i,n) vec[i]=i;
    vector<int> a(m);
    rep(i,m){
        cin>>a[i];
        a[i]--;
    }
    reverse(all(a));
    rep(i,m){
        swap(vec[a[i]],vec[a[i]+1]);
    }
    //for(int x:vec) cout<<x+1<<endl;
    
    vector<vector<int>> t(33,vector<int>(n));
    rep(j,n) t[0][j]=vec[j];
    rep(i,32){
        rep(j,n){
            t[i+1][j]=t[i][t[i][j]];
        }
    }
    
    rep(i,n){
        int now=i;
        rep(j,32){
            if(d&(1<<j)){
                now=t[j][now];
            }
        }
        cout<<now+1<<endl;
    }
}

Submission

Task問題 D - 阿弥陀
User nameユーザ名 gyouzasushi
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1062 Byte
File nameファイル名
Exec time実行時間 226 ms
Memory usageメモリ使用量 14968 KB

Test case

Set

Set name Score得点 / Max score Cases
Subtask1 10 / 10 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 20 / 20 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 20 / 20 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 50 / 50 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01_i.txt AC 222 ms 14968 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 9 ms 768 KB
01_random05.txt AC 174 ms 14200 KB
01_random06.txt AC 206 ms 14712 KB
01_random07.txt AC 221 ms 14968 KB
02_i.txt AC 3 ms 384 KB
02_p.txt AC 3 ms 384 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 384 KB
02_random05.txt AC 7 ms 512 KB
02_random06.txt AC 24 ms 768 KB
02_random07.txt AC 45 ms 1152 KB
02_random08.txt AC 45 ms 1152 KB
02_rp01.txt AC 3 ms 384 KB
02_rp02.txt AC 3 ms 384 KB
02_rp03.txt AC 3 ms 384 KB
02_rp04.txt AC 3 ms 384 KB
02_rp05.txt AC 3 ms 384 KB
03_i.txt AC 1 ms 256 KB
03_random01.txt AC 4 ms 256 KB
03_random02.txt AC 31 ms 1024 KB
03_random03.txt AC 26 ms 896 KB
03_random04.txt AC 25 ms 896 KB
03_random05.txt AC 6 ms 384 KB
03_random06.txt AC 5 ms 384 KB
03_random07.txt AC 8 ms 384 KB
03_random08.txt AC 2 ms 256 KB
03_random09.txt AC 10 ms 512 KB
03_random10.txt AC 17 ms 640 KB
03_random11.txt AC 30 ms 1024 KB
03_random12.txt AC 31 ms 1024 KB
03_random13.txt AC 25 ms 768 KB
03_random14.txt AC 19 ms 768 KB
03_random15.txt AC 8 ms 384 KB
04_i.txt AC 226 ms 14968 KB
04_p1.txt AC 194 ms 14584 KB
04_p2.txt AC 153 ms 11592 KB
04_random01.txt AC 120 ms 8360 KB
04_random02.txt AC 99 ms 6608 KB
04_random03.txt AC 44 ms 2176 KB
04_random04.txt AC 60 ms 2176 KB
04_random05.txt AC 62 ms 2816 KB
04_random06.txt AC 126 ms 8980 KB
04_random07.txt AC 113 ms 6004 KB
04_random08.txt AC 95 ms 5120 KB
04_random09.txt AC 80 ms 3456 KB
04_random10.txt AC 124 ms 8976 KB
04_random11.txt AC 221 ms 14968 KB
04_random12.txt AC 225 ms 14968 KB
04_random13.txt AC 221 ms 14968 KB
04_rp01.txt AC 193 ms 14584 KB
04_rp02.txt AC 191 ms 14584 KB
04_rp03.txt AC 193 ms 14584 KB
04_rp04.txt AC 193 ms 14584 KB
04_rp05.txt AC 192 ms 14584 KB
04_rp06.txt AC 194 ms 14584 KB
04_rp07.txt AC 192 ms 14584 KB
04_rp08.txt AC 197 ms 14584 KB
04_rp09.txt AC 194 ms 14584 KB
04_rp10.txt AC 194 ms 14584 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