4971. Swap
时间限制:1000 MS 内存限制:256 MB
题目描述
## 题目描述 Write a program which reads a sequence of integers A={a0,a1,...,an-1}A={a0,a1,...,an-1} and swap specified elements by a list of the following operation: - swapRange(b,e,tb,e,t): For each integer kk (0\lek<(e-b)0\lek<(e-b), swap element (b+k)(b+k) and element (t+k)(t+k). ## 输入格式 The input is given in the following format. ``` nn a0a1...,an−1a0a1...,an−1 qq b1e1t1b1e1t1 b2e2t2b2e2t2 : bqeqtqbqeqtq ``` In the first line, nn (the number of elements in AA) is given. In the second line, aiai (each element in AA) are given. In the third line, the number of queries qq is given and each query is given by three integers bieitibieiti in the following qq lines. ## 输出格式 Print all elements of AA in a line after performing the given operations. Put a single space character between adjacency elements and a newline at the end of the last element. ## 数据范围 - 1\len\le1,0001\len\le1,000 - -1,000,000,000\leai\le1,000,000,000-1,000,000,000\leai\le1,000,000,000 - 1\leq\le1,0001\leq\le1,000 - 0\lebi<ei\len0\lebi<ei\len - 0\leti<ti+(ei-bi)\len0\leti<ti+(ei-bi)\len - Given swap ranges do not overlap each other ## 输入 ```in1 11 1 2 3 4 5 6 7 8 9 10 11 1 1 4 7 ``` ## 输出 ```out1 1 8 9 10 5 6 7 2 3 4 11 ```