Submission #6903334
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<char,char> PCC;
typedef pair<ll,ll> PLL;
typedef pair<char,int> PCI;
typedef pair<int,char> PIC;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<ll,char> PLC;
typedef pair<char,ll> PCL;
inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}
int main(void){
SPEEDUP
cout << setprecision(15);
int N,M,D;cin >> N >> M >> D;
vector<int> v(N+1);
int n_2 = 0;
{
int n = D;
while(n){
++n_2;
n/=2;
}
}
vector<vector<int> > d(n_2,vector<int>(N+1));
rep(i,N+1)v[i] = i;
rep(i,M){
int x;cin >> x;
swap(v[x],v[x+1]);
}
repp(i,1,N+1) d[0][v[i]] = i;
repp(i,1,N+1) cout << d[0][i] SPF;
cout << endl;
repp(n,1,n_2){
repp(i,1,N+1) d[n][i] = d[n-1][d[n-1][i]];
repp(i,1,N+1) cout << d[n][i] SPF;
cout << endl;
}
int dp[2][N+1];
int *pre,*nxt;
pre = dp[0];
nxt = dp[1];
rep(i,N+1) pre[i] = i;
rep(n,n_2){
if(D>>n&1){
repp(i,1,N+1) nxt[i] = d[n][pre[i]];
swap(pre,nxt);
}
}
swap(pre,nxt);
repp(i,1,N+1) cout << nxt[i] << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
D - 阿弥陀 |
User |
mitsuki_AC |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1942 Byte |
Status |
WA |
Exec Time |
401 ms |
Memory |
31096 KB |
Judge Result
Set Name |
Subtask1 |
Subtask2 |
Subtask3 |
Subtask4 |
Score / Max Score |
0 / 10 |
0 / 20 |
0 / 20 |
0 / 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 |
WA |
176 ms |
2936 KB |
01_random01.txt |
WA |
1 ms |
256 KB |
01_random02.txt |
WA |
1 ms |
256 KB |
01_random03.txt |
WA |
1 ms |
256 KB |
01_random04.txt |
WA |
7 ms |
384 KB |
01_random05.txt |
WA |
169 ms |
2936 KB |
01_random06.txt |
WA |
172 ms |
2936 KB |
01_random07.txt |
WA |
175 ms |
2936 KB |
02_i.txt |
WA |
4 ms |
384 KB |
02_p.txt |
WA |
3 ms |
384 KB |
02_random01.txt |
WA |
1 ms |
256 KB |
02_random02.txt |
WA |
1 ms |
256 KB |
02_random03.txt |
WA |
3 ms |
384 KB |
02_random04.txt |
WA |
3 ms |
384 KB |
02_random05.txt |
WA |
5 ms |
384 KB |
02_random06.txt |
WA |
10 ms |
256 KB |
02_random07.txt |
WA |
17 ms |
384 KB |
02_random08.txt |
WA |
17 ms |
384 KB |
02_rp01.txt |
WA |
4 ms |
384 KB |
02_rp02.txt |
WA |
3 ms |
384 KB |
02_rp03.txt |
WA |
3 ms |
384 KB |
02_rp04.txt |
WA |
4 ms |
384 KB |
02_rp05.txt |
WA |
4 ms |
384 KB |
03_i.txt |
WA |
1 ms |
256 KB |
03_random01.txt |
WA |
2 ms |
256 KB |
03_random02.txt |
WA |
12 ms |
256 KB |
03_random03.txt |
WA |
10 ms |
256 KB |
03_random04.txt |
WA |
10 ms |
256 KB |
03_random05.txt |
WA |
3 ms |
256 KB |
03_random06.txt |
WA |
3 ms |
256 KB |
03_random07.txt |
WA |
4 ms |
256 KB |
03_random08.txt |
WA |
1 ms |
256 KB |
03_random09.txt |
WA |
4 ms |
256 KB |
03_random10.txt |
WA |
7 ms |
256 KB |
03_random11.txt |
WA |
11 ms |
256 KB |
03_random12.txt |
WA |
12 ms |
256 KB |
03_random13.txt |
WA |
9 ms |
256 KB |
03_random14.txt |
WA |
8 ms |
256 KB |
03_random15.txt |
WA |
4 ms |
256 KB |
04_i.txt |
WA |
401 ms |
30968 KB |
04_p1.txt |
WA |
380 ms |
29944 KB |
04_p2.txt |
WA |
296 ms |
23112 KB |
04_random01.txt |
WA |
218 ms |
17064 KB |
04_random02.txt |
WA |
171 ms |
13776 KB |
04_random03.txt |
WA |
48 ms |
3200 KB |
04_random04.txt |
WA |
46 ms |
2560 KB |
04_random05.txt |
WA |
64 ms |
4224 KB |
04_random06.txt |
WA |
236 ms |
18580 KB |
04_random07.txt |
WA |
149 ms |
10868 KB |
04_random08.txt |
WA |
119 ms |
8320 KB |
04_random09.txt |
WA |
80 ms |
5120 KB |
04_random10.txt |
WA |
237 ms |
18832 KB |
04_random11.txt |
WA |
383 ms |
29048 KB |
04_random12.txt |
WA |
395 ms |
30072 KB |
04_random13.txt |
WA |
365 ms |
27128 KB |
04_rp01.txt |
WA |
377 ms |
29048 KB |
04_rp02.txt |
WA |
379 ms |
29048 KB |
04_rp03.txt |
WA |
389 ms |
31096 KB |
04_rp04.txt |
WA |
376 ms |
29048 KB |
04_rp05.txt |
WA |
367 ms |
28280 KB |
04_rp06.txt |
WA |
366 ms |
28152 KB |
04_rp07.txt |
WA |
366 ms |
28152 KB |
04_rp08.txt |
WA |
375 ms |
29048 KB |
04_rp09.txt |
WA |
393 ms |
30968 KB |
04_rp10.txt |
WA |
388 ms |
30968 KB |
sample_1.txt |
WA |
1 ms |
256 KB |
sample_2.txt |
WA |
1 ms |
256 KB |
sample_3.txt |
WA |
1 ms |
256 KB |