Submission #215005


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

long i,j;

int main(){
  int n,m;
  long d;
  int *a;
  int s;
  int *x,*y,*z;

  scanf("%d %d %ld",&n,&m,&d);
  a = (int*)malloc(sizeof(int)*m);
  x = (int*)malloc(sizeof(int)*n);
  y = (int*)malloc(sizeof(int)*n);
  z = (int*)malloc(sizeof(int)*n);
  for(i=0;i<m;i++)
    scanf("%d",&a[i]);

  for(i=0;i<n;i++){
    x[i]=i+1;
    y[i]=i+1;
  }

  for(i=0;i<m;i++){
    s = x[a[i]-1];
    x[a[i]-1] = x[a[i]];
    x[a[i]] = s;
  }

  for(i=0;i<n;i++){
    z[x[i]-1]=i+1;
  }

  for(j=0;j<n;j++){
    x[j]=z[z[z[y[j]-1]-1]-1];
  }

  while(d%3 != 0){
    for(j=0;j<n;j++){
      y[j]=z[y[j]-1];
    }
    d--;
  }

  for(i=0;i<d;i+=3){
    for(j=0;j<n;j++){
      y[j]=x[y[j]-1];
    }  
  }

  for(i=0;i<n;i++){
    printf("%d\n",y[i]);
  }
  return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User Tanix
Language C (GCC 4.6.4)
Score 30
Code Size 894 Byte
Status TLE
Exec Time 4031 ms
Memory 3232 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:15:8: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
./Main.c:21:10: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]

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 × 17
TLE × 1
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 70 ms 3232 KB
01_random01.txt AC 21 ms 792 KB
01_random02.txt AC 19 ms 700 KB
01_random03.txt AC 19 ms 796 KB
01_random04.txt AC 21 ms 800 KB
01_random05.txt AC 42 ms 2460 KB
01_random06.txt AC 63 ms 2972 KB
01_random07.txt AC 71 ms 3224 KB
02_i.txt AC 20 ms 688 KB
02_p.txt AC 24 ms 768 KB
02_random01.txt AC 19 ms 800 KB
02_random02.txt AC 19 ms 676 KB
02_random03.txt AC 20 ms 796 KB
02_random04.txt AC 20 ms 692 KB
02_random05.txt AC 23 ms 928 KB
02_random06.txt AC 34 ms 1064 KB
02_random07.txt AC 49 ms 1448 KB
02_random08.txt AC 50 ms 1448 KB
02_rp01.txt AC 20 ms 792 KB
02_rp02.txt AC 20 ms 800 KB
02_rp03.txt AC 19 ms 700 KB
02_rp04.txt AC 33 ms 796 KB
02_rp05.txt AC 20 ms 800 KB
03_i.txt TLE 4029 ms 796 KB
03_random01.txt AC 180 ms 800 KB
03_random02.txt AC 486 ms 1444 KB
03_random03.txt AC 1158 ms 1316 KB
03_random04.txt AC 376 ms 1252 KB
03_random05.txt AC 2002 ms 928 KB
03_random06.txt AC 2402 ms 796 KB
03_random07.txt AC 2166 ms 928 KB
03_random08.txt AC 231 ms 700 KB
03_random09.txt AC 639 ms 936 KB
03_random10.txt AC 1613 ms 1060 KB
03_random11.txt AC 3792 ms 1448 KB
03_random12.txt AC 1597 ms 1444 KB
03_random13.txt AC 1079 ms 1184 KB
03_random14.txt AC 157 ms 1184 KB
03_random15.txt AC 2498 ms 868 KB
04_i.txt TLE 4030 ms 2792 KB
04_p1.txt TLE 4029 ms 2332 KB
04_p2.txt TLE 4029 ms 2084 KB
04_random01.txt TLE 4029 ms 1896 KB
04_random02.txt TLE 4029 ms 1436 KB
04_random03.txt TLE 4029 ms 1248 KB
04_random04.txt TLE 4029 ms 1576 KB
04_random05.txt TLE 4029 ms 1572 KB
04_random06.txt TLE 4029 ms 1768 KB
04_random07.txt TLE 4029 ms 1960 KB
04_random08.txt TLE 4030 ms 1832 KB
04_random09.txt TLE 4029 ms 1820 KB
04_random10.txt TLE 4029 ms 1784 KB
04_random11.txt TLE 4029 ms 2680 KB
04_random12.txt TLE 4030 ms 2784 KB
04_random13.txt TLE 4030 ms 2788 KB
04_rp01.txt TLE 4030 ms 2400 KB
04_rp02.txt TLE 4030 ms 2348 KB
04_rp03.txt TLE 4031 ms 2340 KB
04_rp04.txt TLE 4029 ms 2400 KB
04_rp05.txt TLE 4029 ms 2340 KB
04_rp06.txt TLE 4030 ms 2340 KB
04_rp07.txt TLE 4029 ms 2348 KB
04_rp08.txt TLE 4029 ms 2332 KB
04_rp09.txt TLE 4030 ms 2340 KB
04_rp10.txt TLE 4029 ms 2332 KB
sample_1.txt AC 19 ms 704 KB
sample_2.txt AC 19 ms 704 KB
sample_3.txt AC 20 ms 800 KB