Submission #214992
Source Code Expand
Copy
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>
using namespace std;
#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))
template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }
typedef long long ll;
typedef pair<int, int> pint;
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };
vector<int> simulate(const vector<int>& a, const vector<int>& from)
{
vector<int> res(a.size());
rep(i, sz(a))
res[i] = a[from[i]];
return res;
}
vector<int> rev(const vector<int>& a)
{
vector<int> res(a.size());
rep(i, sz(a))
res[a[i]] = i;
return res;
}
int main()
{
fast_io();
int n, m, d;
cin >> n >> m >> d;
vector<int> from(n);
rep(i, n)
from[i] = i;
rep(i, m)
{
int a;
cin >> a;
--a;
swap(from[a], from[a + 1]);
}
vector<int> dd(n);
rep(i, n)
dd[i] = i;
for (int bb = 1; bb <= d; bb <<= 1)
{
if (d & bb)
dd = simulate(dd, from);
from = simulate(from, from);
}
for (int i : rev(dd))
cout << i + 1 << endl;
}
Submission Info
Submission Time |
|
Task |
D - 阿弥陀 |
User |
takapt |
Language |
C++11 (GCC 4.8.1) |
Score |
100 |
Code Size |
4076 Byte |
Status |
AC |
Exec Time |
548 ms |
Memory |
2684 KB |
Judge Result
Set Name |
Subtask1 |
Subtask2 |
Subtask3 |
Subtask4 |
Score / Max Score |
10 / 10 |
20 / 20 |
20 / 20 |
50 / 50 |
Status |
|
|
|
|
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 |
441 ms |
2448 KB |
01_random01.txt |
AC |
23 ms |
924 KB |
01_random02.txt |
AC |
23 ms |
736 KB |
01_random03.txt |
AC |
21 ms |
800 KB |
01_random04.txt |
AC |
37 ms |
800 KB |
01_random05.txt |
AC |
414 ms |
2456 KB |
01_random06.txt |
AC |
429 ms |
2448 KB |
01_random07.txt |
AC |
464 ms |
2448 KB |
02_i.txt |
AC |
26 ms |
796 KB |
02_p.txt |
AC |
52 ms |
804 KB |
02_random01.txt |
AC |
22 ms |
924 KB |
02_random02.txt |
AC |
23 ms |
808 KB |
02_random03.txt |
AC |
24 ms |
796 KB |
02_random04.txt |
AC |
24 ms |
928 KB |
02_random05.txt |
AC |
28 ms |
932 KB |
02_random06.txt |
AC |
36 ms |
928 KB |
02_random07.txt |
AC |
48 ms |
832 KB |
02_random08.txt |
AC |
48 ms |
924 KB |
02_rp01.txt |
AC |
26 ms |
920 KB |
02_rp02.txt |
AC |
34 ms |
932 KB |
02_rp03.txt |
AC |
24 ms |
796 KB |
02_rp04.txt |
AC |
25 ms |
920 KB |
02_rp05.txt |
AC |
27 ms |
928 KB |
03_i.txt |
AC |
21 ms |
796 KB |
03_random01.txt |
AC |
27 ms |
932 KB |
03_random02.txt |
AC |
47 ms |
920 KB |
03_random03.txt |
AC |
37 ms |
792 KB |
03_random04.txt |
AC |
36 ms |
928 KB |
03_random05.txt |
AC |
25 ms |
796 KB |
03_random06.txt |
AC |
24 ms |
928 KB |
03_random07.txt |
AC |
25 ms |
924 KB |
03_random08.txt |
AC |
22 ms |
928 KB |
03_random09.txt |
AC |
56 ms |
920 KB |
03_random10.txt |
AC |
30 ms |
928 KB |
03_random11.txt |
AC |
37 ms |
928 KB |
03_random12.txt |
AC |
37 ms |
924 KB |
03_random13.txt |
AC |
43 ms |
800 KB |
03_random14.txt |
AC |
32 ms |
928 KB |
03_random15.txt |
AC |
26 ms |
924 KB |
04_i.txt |
AC |
467 ms |
2572 KB |
04_p1.txt |
AC |
429 ms |
2448 KB |
04_p2.txt |
AC |
344 ms |
2180 KB |
04_random01.txt |
AC |
262 ms |
1688 KB |
04_random02.txt |
AC |
203 ms |
1556 KB |
04_random03.txt |
AC |
80 ms |
896 KB |
04_random04.txt |
AC |
77 ms |
920 KB |
04_random05.txt |
AC |
94 ms |
936 KB |
04_random06.txt |
AC |
273 ms |
1764 KB |
04_random07.txt |
AC |
190 ms |
1416 KB |
04_random08.txt |
AC |
174 ms |
1316 KB |
04_random09.txt |
AC |
121 ms |
1060 KB |
04_random10.txt |
AC |
271 ms |
1880 KB |
04_random11.txt |
AC |
548 ms |
2568 KB |
04_random12.txt |
AC |
467 ms |
2560 KB |
04_random13.txt |
AC |
454 ms |
2564 KB |
04_rp01.txt |
AC |
447 ms |
2576 KB |
04_rp02.txt |
AC |
450 ms |
2448 KB |
04_rp03.txt |
AC |
449 ms |
2444 KB |
04_rp04.txt |
AC |
455 ms |
2448 KB |
04_rp05.txt |
AC |
443 ms |
2452 KB |
04_rp06.txt |
AC |
437 ms |
2448 KB |
04_rp07.txt |
AC |
439 ms |
2448 KB |
04_rp08.txt |
AC |
421 ms |
2572 KB |
04_rp09.txt |
AC |
431 ms |
2512 KB |
04_rp10.txt |
AC |
427 ms |
2684 KB |
sample_1.txt |
AC |
20 ms |
920 KB |
sample_2.txt |
AC |
23 ms |
924 KB |
sample_3.txt |
AC |
25 ms |
764 KB |