0w1

Entries from 2016-03-23 to 1 day

CFR 546 C. Soldier and Cards ( 狀態記錄 )

http://codeforces.com/contest/546/problem/C 水。 #include <bits/stdc++.h> using namespace std; const int MAXN = 10 + 2; int n; deque< int > dq1, dq2; typedef pair< deque< int >, deque< int > > pdq; set< pdq > vis; void solve(){ int rnd_cnt = 0; while( !d</bits/stdc++.h>…

CFR 546 D. Soldier and Number Game ( 素数分解 )

http://codeforces.com/contest/546/problem/D 用質數預處理的方法快速計算每個值可以分解成多少質因數。 #include <bits/stdc++.h> using namespace std; const int MAXT = 1e6 + 6; const int MAXAB = 5e6 + 6; typedef long long ll; ll ps[ MAXAB ]; int val[ MAXAB ], </bits/stdc++.h>…

IOI 15 Horses ( Segment Tree )

終於做出來了。。 首先要直覺地想到,如果有一個日期是值得賣的,那麼一定會將所有都在這一天賣出去,因為如果留到後面的價值更高,這一天就根本不會是值得賣的。 如果要比較兩個不同日期賣出的錢,舉例來說比較 day i 和 day j,且不失一般性 i x[ 1 ] * x[…

UVA 11487 Gathering Food ( DP 統計路徑數 )

傳出去才覺得dp判斷該不該走的部分怪怪的,不過AC了。之後可能要小心一點,從終點回去比較好。 #include <bits/stdc++.h> using namespace std; const int MAXN = 10 + 2; const int INF = 0x3f3f3f3f; const int dx[] = { 0, 1, 0, -1 }; const int dy[] = { 1, 0, -1, 0 }</bits/stdc++.h>…

UVA 11167 Monkeys in the Emei Mountain ( 區間分配置點問題 )

很經典的算法。只是不知道時間複雜度對不對。嘛AC了就算了。 追記:後來發現這是題 Dinic題,竟然被我亂水過了,估算一下我的時間複雜度,O( N * lg N + MAXB * M * lg N ),咦,感覺挺好的啊。。 blog.csdn.net 大神 241行的 code.. Orz 拜了 這故事告訴我…

TOI 日記 Day9

今日はpaizaのスキルチェックの問題解いてた。サイコロ系の問題で苦戦。。満点取れたはずのを見逃した。S級の問題はもう全部開けたので今は銀のままでのぼらない。。最難問だと言われてる「嘘つき探し」を適当に貪欲してみたらWAをもらったけど30点取った…