原创 【UVA10859】Placing Lampposts
題面 As a part of the mission ‘Beautification of Dhaka City’, the government has decided to replace all the old la
原创 【UVA12083】Guardian of Decency
題意 有N 個人,每個人有四個屬性:W,Sex,Mu,Sp 兩個人u 和v 不能出現在同一個集合當且僅當滿足: |Wu−Wv|≤40,Sexu≠Sexv
原创 【UVA12124】Assemble
題面 Recently your team noticed that the computer you use to practice for programming contests is not good enough
原创 【Uva11806】Cheerleaders
題面 In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their ro
原创 【UVA11374】Airport Express
題意 Graph= {V,E1,E2 },邊有邊權 現在要從S 到達T ,期間有一次機會能夠通過E2 中的邊,其餘時候只能走E1 中的邊,問最短路徑,最短路,如果使用了E2 中的邊,還需輸出經過邊的
原创 【UVA11825】Hackers' Crackdown
題意 Miracle Corporations has a number of system services running in a distributed computer system which is a prim
原创 【UVA12097】Pie
題面 My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them,
原创 【UVA11235】Frequent values
題意 有序列{Sn },並且S 單調不降 有Q 組詢問,每一組詢問爲【l,r】 內出現次數最高的數的出現次數 1≤n,Q≤106 ,多組數據 解法 線段樹:
原创 【UVA11624】Fire!
題面 Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze negle
原创 【UVA1328】Period
題意 給定一個字符串S ,求該字符串每一個前綴的循環節長度,如果循環節長度不爲1則輸出(格式看題目) 解法 KMP : 首先想這麼一個問題:給定一個字符串S ,由n 個子串重複得到,求最大的n
原创 【UVA1352】Colored Cubes
題面 大火題……上圖: 題意 有n 個正方體(n≤4 ),每個正方體的六個面都有一個顏色。兩個正方體是相同的當且僅當其中一個正方體能夠通過某種旋轉使其六個面的顏色與另一個正方體一一對應。現在你可以對正方體進行
原创 【UVA1335】Beijing Guards
題面 Beijing was once surrounded by four rings of city walls: the Forbidden City Wall, the Imperial City Wall, the
原创 【UVA1455】Kingdom
題意 有n 個點和m 個操作,分爲兩種: ①.road u v 表示連接u 號點和v 號點 ②.line C (C 爲小數,並且小數部分一定爲0.5)表示詢問y=C
原创 【UVA11997】K Smallest Sums
題意 有n 個序列,每個序列有n 個元素。現在要在每個序列裏選一個元素出來,求元素總和前n 小的值 解法 優先隊列: 最簡單的想法就是直接枚舉所有可能的方案,然後排序求出前n 小的方案
原创 【UVA1428】Ping pong
題面 N (3 ≤ N ≤ 20000) ping pong players live along a west-east street(consider the street as a line segment).