Submission #1772422


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)      //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++) //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)    //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))        //array size
#define SORTD(a) sort(a,a+ASIZE(a),greater<int>()) //sort in descending order for array
#define SORTA(a) sort(a,a+ASIZE(a))                //sort in ascending order for array
#define SORTS(a) sort(a.begin(),a.end())           //sort in ascending order for string type
typedef long long LL;
typedef unsigned int UINT;
typedef pair<int, int> P;
 
void SCAN(int *a){scanf("%d",a);}                             //scan for type int
void SCAN(int *a,int n){int i;REP(i,n){scanf("%d",&a[i]);}}   //scan for type int array
void SCAN(UINT *a){scanf("%u",a);}                            //scan for type unsigned int
void SCAN(UINT *a,int n){int i;REP(i,n){scanf("%u",&a[i]);}}  //scan for type unsigned int array
void SCAN(LL *a){scanf("%lld",a);}                            //scan for type long long int
void SCAN(LL *a,int n){int i;REP(i,n){scanf("%lld",&a[i]);}}  //scan for type long long int array
void SCAN(char *c){scanf(" %c",c);}                           //scan for type char
void SCAN(char *c,int n){int i;REP(i,n){scanf(" %c",&c[i]);}} //scan for type char array
 
const int MOD = 1000000007;
const int INF = 1999999999;
const LL INFLL = 999999999999999;

const int DX4[4]= {-1,0,1,0};
const int DY4[4]= {0,-1,0,1};

//fill an N-dimensional array with val
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
	fill((T*)array,(T*)(array+N),val);
}
 
long double pascalTri(int n,int r){
	long double tri[n+1][n+1];
	int i,j;
	REP(i,n+1){REP(j,n+1){tri[i][j]=0;}}
	REP(i,n+1){
		REP(j,n+1){
			if(j>i){break;}
			if(j==0||j==i){tri[i][j]=1;}else{tri[i][j]=(tri[i-1][j-1]+tri[i-1][j]);}
		}
	}
	return tri[n][r];
}


int main(){
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	int n,m,d;
	int i,j,k;

	SCAN(&n);SCAN(&m);SCAN(&d);

	int a[m];
	SCAN(a,m);
	
	int list[n];
	LL nf=1;
	REP(i,n){
		list[i]=i;
		nf*=n-i;
	}
	//d=d%nf;
	REP(i,m){
		swap(list[a[i]],list[a[i]-1]);
	}
	
	int t[n];
	REP(i,n){
		t[list[i]]=i;
	}

	int ans[n];
	REP(i,n){
		ans[i]=i;
		REP(j,d){			
			ans[i]=t[ans[i]];
		}
	}

	REP(i,n){
		printf("%d\n",ans[i]+1);
	}
	return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User nabe12
Language C++14 (GCC 5.4.1)
Score 30
Code Size 2573 Byte
Status TLE
Exec Time 4203 ms
Memory 2816 KB

Compile Error

./Main.cpp: In function ‘void SCAN(int*)’:
./Main.cpp:16:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 void SCAN(int *a){scanf("%d",a);}                             //scan for type int
                                ^
./Main.cpp: In function ‘void SCAN(int*, int)’:
./Main.cpp:17:57: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 void SCAN(int *a,int n){int i;REP(i,n){scanf("%d",&a[i]);}}   //scan for type int array
                                                         ^
./Main.cpp: In function ‘void SCAN(UINT*)’:
./Main.cpp:18:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 void SCAN(UINT *a){scanf("%u",a);}                            //scan for type unsigned int
                                 ^
./Main.cpp: In function ‘void SCAN(UINT*, int)’:
./Main.cpp:19...

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 10 / 10 20 / 20 0 / 20 0 / 50
Status
AC × 9
AC × 18
AC × 10
TLE × 8
AC × 3
TLE × 26
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 29 ms 2816 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 2 ms 384 KB
01_random05.txt AC 13 ms 2048 KB
01_random06.txt AC 24 ms 2560 KB
01_random07.txt AC 29 ms 2816 KB
02_i.txt AC 3 ms 256 KB
02_p.txt AC 3 ms 256 KB
02_random01.txt AC 1 ms 256 KB
02_random02.txt AC 1 ms 256 KB
02_random03.txt AC 2 ms 256 KB
02_random04.txt AC 3 ms 256 KB
02_random05.txt AC 3 ms 384 KB
02_random06.txt AC 10 ms 640 KB
02_random07.txt AC 20 ms 1024 KB
02_random08.txt AC 20 ms 1024 KB
02_rp01.txt AC 2 ms 256 KB
02_rp02.txt AC 2 ms 256 KB
02_rp03.txt AC 1 ms 256 KB
02_rp04.txt AC 2 ms 256 KB
02_rp05.txt AC 2 ms 256 KB
03_i.txt TLE 4203 ms 256 KB
03_random01.txt AC 262 ms 256 KB
03_random02.txt AC 549 ms 1024 KB
03_random03.txt AC 1150 ms 896 KB
03_random04.txt AC 1003 ms 896 KB
03_random05.txt TLE 4203 ms 384 KB
03_random06.txt TLE 4203 ms 384 KB
03_random07.txt TLE 4203 ms 384 KB
03_random08.txt AC 647 ms 256 KB
03_random09.txt AC 1808 ms 512 KB
03_random10.txt TLE 4203 ms 640 KB
03_random11.txt TLE 4203 ms 896 KB
03_random12.txt TLE 4203 ms 1024 KB
03_random13.txt AC 3185 ms 768 KB
03_random14.txt AC 384 ms 768 KB
03_random15.txt TLE 4203 ms 384 KB
04_i.txt TLE 4203 ms 1792 KB
04_p1.txt TLE 4203 ms 1408 KB
04_p2.txt TLE 4203 ms 1152 KB
04_random01.txt TLE 4203 ms 1024 KB
04_random02.txt TLE 4203 ms 768 KB
04_random03.txt TLE 4203 ms 768 KB
04_random04.txt TLE 4203 ms 1024 KB
04_random05.txt TLE 4203 ms 896 KB
04_random06.txt TLE 4203 ms 1024 KB
04_random07.txt TLE 4203 ms 1280 KB
04_random08.txt TLE 4203 ms 1152 KB
04_random09.txt TLE 4203 ms 1152 KB
04_random10.txt TLE 4203 ms 896 KB
04_random11.txt TLE 4203 ms 1792 KB
04_random12.txt TLE 4203 ms 1792 KB
04_random13.txt TLE 4203 ms 1792 KB
04_rp01.txt TLE 4203 ms 1408 KB
04_rp02.txt TLE 4203 ms 1408 KB
04_rp03.txt TLE 4203 ms 1408 KB
04_rp04.txt TLE 4203 ms 1408 KB
04_rp05.txt TLE 4203 ms 1408 KB
04_rp06.txt TLE 4203 ms 1408 KB
04_rp07.txt TLE 4203 ms 1408 KB
04_rp08.txt TLE 4203 ms 1408 KB
04_rp09.txt TLE 4203 ms 1408 KB
04_rp10.txt TLE 4203 ms 1408 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