Beruflich Dokumente
Kultur Dokumente
Editors:
Fernando Torres
1
Preface
This electronic material contains a set of algorithmic problems, forming the archives of the Gia?i bai
tru+.c tuye^’n (http://www.spoj.pl/SPOJVN/), main problemset. The document can be accessed at the
following URLs:
These resources are constantly updated to synchronise with the ever-changing hypertext version of the
problems, and to include newly added problems. If you have obtained this document from another
source, it is strongly recommended that you should download the current version from one of the
aforementioned URLs.
Disclaimer from the Editors. Despite our best efforts, it is possible that this document contains errors or that some of the
content differs slightly from its original hypertext form. We take no responsibility for any such faults and their
consequences. We neither authorise nor approve use of this material for any purpose other than facilitating problem solving
at the Sphere Online Judge site; nor do we guarantee its fitness for any purpose whatsoever.
The layout of the problems in this document is the copyright of the Editors named on the cover (as determined by the
appropriate footers in the problem description). The content is the copyright of the respective Editor unless the copyright
holder is otherwise stated in the ’resource’ section. The document as a whole is not protected by copyright, and fragments
of it are to be regarded independently. No responsibility is taken by the Editors if use or redistribution of this document
violates either their or third party copyright laws. When referring to or citing the whole or a fragment of this document,
please state clearly the aforementioned URLs at which the document is to be found, as well as the resources from which the
problems you are referring to originally came.
Remarks concerning this document should be sent to the following e-mail address: contact@spoj.pl.
2
Table of Contents
1. Problem CARDS (6247. Tráo bai)
3
SPOJ Problem Set (main)
Ví du. vo+’i n = 9
Yeu câu : Hay cho bie^’t sô ghi tren các lá bai sau khi thu+.c hie^.n x phép tráo bai cho tru+o+’c
Input
- Dong 1 : Chu+’a 2 sô nguyen n va x (n,x <= 10^5)
Output
Gôm 1 dong duy nhât chu+’a n sô nguyen. sô thu+’ i la sô ghi tren lá bai thu+’ i.
Example
Input:
9 31 5 25 4 68 2 1Output:
7 8 6 1 2 3 9 4 5