Fork Copy package ngay3; import java.util.Scanner; public class bai3 { static int a[] = new int[1000000]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); for(int t = 1; t <= 10; t++) { int n = sc.nextInt(); System.out.println(n); // int a[] = new int[1000000]; for(int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int c = sc.nextInt(); for(int i = 0; i < c; i++) { char X = sc.next().charAt(0); if(X == 'I') { int x, y; x = sc.nextInt(); y = sc.nextInt(); n += y; //n = 7 j = 6 x = 1 y = 2 for(int j = n-1; j >= x; j--) { a[j] = a[j-y]; } for(int j = x; j < x + y; j++) { a[j] = sc.nextInt(); } } else if (X == 'D'){ int x, y; x = sc.nextInt(); y = sc.nextInt(); for(int j = x + 1; j < n; j++) { a[j] = a[j + y]; } n -= y; } else if (X == 'A'){ int y = sc.nextInt(); for(int j = n; j < n + y; j++) { a[j] = sc.nextInt(); } n += y; } } System.out.print("# " + t); for(int i = 0; i < 10; i++) { System.out.print(" " + a[i]); } System.out.println(); } } }