13372 - Pointer Magic   

Description

After getting rejected by a girl, Morty realizes that he does not need a girlfriend, what he needs is to study programming. He already understands the basics of C programming but is struggling to understand pointers.

To help him understand better, Morty decides to practice making functions to change values of 2 malloced arrays. The functions he made are:

Swap, which takes in 2 characters and 2 integers and uses them for coordinates for the integers that needs to be swapped. (A B 1 2 means to swap the values of A[1] and B[2])  

Switch, swaps all the values of array A and array B

Replace, which takes in 1 character and 2 integers, the first 2 are used for coordinates whereas the last integer is used for the new value.(A 1 100 means replace the value of A[1] to 100)

Stop, which stops the program and prints out the contents of both arrays.

Once Morty finishes this program suddenly the girl he rejected changed her mind, so in order to help you get a girlfriend/boyfriend, Morty wants you to make this program.

This is a partial judge program.

Input

integer M, the size of both arrays

M*2 number of integers which are the values of both arrays

A number of Commands:

Swap (2 characters and 2 integers)

Switch

Replace (1 character and 2 integers)

Stop (Stop the program and print the arrays)

 

Output

The contents of both arrays followed by a newline

Sample Input  Download

Sample Output  Download

Partial Judge Code

13372.c

Partial Judge Header

13372.h

Tags




Discuss