d814. 187. Twist and whirl - want to cheat
標籤 :
通過比率 : 74人/87人 ( 85% ) [非即時]
評分方式:
Tolerant

最近更新 : 2011-04-04 16:51

內容

A well-known sharper I*** invented a new way to swindle people. There are N thimbles on the table, and there is a small ball with the number under each of them. The balls are numbered with numbers from 1 to N from left to right. At one operation I*** changes the order of some subsequence of successive thimbles to the opposite. Your task is to find the order of numbers (from left to right) in sequence after all of his manipulations. The total number of manipulations is M.

【题目大意】

給定一個1~N的排列,每次操作會將[l,r]這個區間上的數翻轉。問到最後,整個排列會變成怎麼樣

 

輸入說明

The first line contains two integer numbers N and M (1<=N<=130000, 1<=M<=2000) separated by a space. Each of the following M lines contains two integer numbers Pi, Qi (1<=Pi<=Qi<=N) - positions of the leftmost and rightmost thimbles in rotated sequence.

 

輸出說明
Output the sequence of N numbers - the numbers of balls in the thimbles from left to right.
範例輸入 #1
5 2
1 3
4 5

5 2
1 4
2 5 
範例輸出 #1
3 2 1 5 4
4 5 1 2 3
測資資訊:
記憶體限制: 512 MB
提示 :

※ 只是想搬好玩的題目過來,不會寫

time limit per test: 0.50 sec.(時間沒辦法設定成0.5s)

memory limit per test: 4096 KB (記憶體沒辦法設定成4MB)

Author:Michael R. Mirzayanov
Resource:ACM International Collegiate Programming Contest 2003-2004
North-Eastern European Region, Southern Subregion
Date:2003 October, 9
 

 

 

 

※ Splay Tree or...

標籤:
出處:
SGU 187 [管理者: morris1028 (碼畜) ]

本題狀況 本題討論 排行

編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」