Submission #215118


Source Code Expand

Copy
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

// figure
typedef long long ll;

// repeat
#define for_(i, a, b) for (int i=a; i<b; i++)
#define for_d(i, b, a) for (int i=b-1; i>=a; i--)
#define FOR(it, c) for(__typeof((c).begin())it=(c).begin(); it!=(c).end(); it++)

// for STL
#define pb push_back
#define sz size()
#define all(x) x.begin(), x.end()
typedef vector<int> veci;
typedef vector<string> vecs;
typedef map<int, int> mapii;
typedef map<char, int> mapci;
typedef pair<int, int> pii;

// memory
#define minit(a, i) memset(a, i, sizeof(a));

// inf
const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

// eps
double EPS = 1e-9;

int N, M, D;
int P[100010], T[100010], S[100010];

void mul() {
	for (int i = 0; i < N; i++) P[i] = T[P[i] - 1];
}

void sqr() {
	for (int i = 0; i < N; i++) S[i] = T[T[i] - 1];
	swap(T, S);
}

int main() {
	cin >> N >> M >> D;
	
	for (int i = 0; i < N; i++) P[i] = i + 1;
	
	for (int i = 0; i < M; i++) {
		int a; cin >> a;
		swap(P[a - 1], P[a]);
	}
	
	for (int i = 0; i < N; i++) {
		T[P[i] - 1] = i + 1;
	}
	
	for (int i = 0; i < N; i++) P[i] = i + 1;
	
	while (D) {
		if (D & 1) mul();
		sqr();
		D >>= 1;
	}
	
	for (int i = 0; i < N; i++) cout << P[i] << endl;
	
	return 0;
}




Submission Info

Submission Time
Task D - 阿弥陀
User tsukasa_diary
Language C++ (G++ 4.6.4)
Score 100
Code Size 1635 Byte
Status AC
Exec Time 556 ms
Memory 2852 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 520 ms 2648 KB
01_random01.txt AC 192 ms 1804 KB
01_random02.txt AC 48 ms 1832 KB
01_random03.txt AC 28 ms 1752 KB
01_random04.txt AC 43 ms 1752 KB
01_random05.txt AC 426 ms 2648 KB
01_random06.txt AC 527 ms 2648 KB
01_random07.txt AC 513 ms 2648 KB
02_i.txt AC 37 ms 1764 KB
02_p.txt AC 33 ms 1748 KB
02_random01.txt AC 28 ms 1752 KB
02_random02.txt AC 30 ms 1752 KB
02_random03.txt AC 33 ms 1760 KB
02_random04.txt AC 33 ms 1748 KB
02_random05.txt AC 40 ms 1752 KB
02_random06.txt AC 68 ms 1756 KB
02_random07.txt AC 104 ms 1836 KB
02_random08.txt AC 109 ms 1708 KB
02_rp01.txt AC 32 ms 1756 KB
02_rp02.txt AC 32 ms 1752 KB
02_rp03.txt AC 32 ms 1752 KB
02_rp04.txt AC 33 ms 1760 KB
02_rp05.txt AC 33 ms 1832 KB
03_i.txt AC 34 ms 1756 KB
03_random01.txt AC 36 ms 1744 KB
03_random02.txt AC 80 ms 1752 KB
03_random03.txt AC 71 ms 1760 KB
03_random04.txt AC 70 ms 1752 KB
03_random05.txt AC 39 ms 1756 KB
03_random06.txt AC 39 ms 1752 KB
03_random07.txt AC 43 ms 1748 KB
03_random08.txt AC 31 ms 1756 KB
03_random09.txt AC 48 ms 1836 KB
03_random10.txt AC 59 ms 1744 KB
03_random11.txt AC 77 ms 1752 KB
03_random12.txt AC 81 ms 1704 KB
03_random13.txt AC 68 ms 1760 KB
03_random14.txt AC 60 ms 1764 KB
03_random15.txt AC 43 ms 1752 KB
04_i.txt AC 525 ms 2648 KB
04_p1.txt AC 475 ms 2648 KB
04_p2.txt AC 386 ms 2516 KB
04_random01.txt AC 306 ms 2264 KB
04_random02.txt AC 231 ms 2204 KB
04_random03.txt AC 116 ms 1884 KB
04_random04.txt AC 148 ms 1748 KB
04_random05.txt AC 161 ms 1832 KB
04_random06.txt AC 325 ms 2348 KB
04_random07.txt AC 277 ms 2216 KB
04_random08.txt AC 229 ms 2008 KB
04_random09.txt AC 189 ms 1876 KB
04_random10.txt AC 304 ms 2260 KB
04_random11.txt AC 541 ms 2652 KB
04_random12.txt AC 552 ms 2732 KB
04_random13.txt AC 556 ms 2848 KB
04_rp01.txt AC 474 ms 2652 KB
04_rp02.txt AC 476 ms 2644 KB
04_rp03.txt AC 468 ms 2644 KB
04_rp04.txt AC 473 ms 2644 KB
04_rp05.txt AC 474 ms 2652 KB
04_rp06.txt AC 479 ms 2652 KB
04_rp07.txt AC 503 ms 2732 KB
04_rp08.txt AC 486 ms 2648 KB
04_rp09.txt AC 472 ms 2852 KB
04_rp10.txt AC 478 ms 2644 KB
sample_1.txt AC 37 ms 1708 KB
sample_2.txt AC 32 ms 1816 KB
sample_3.txt AC 29 ms 1752 KB