2013-05-01から1ヶ月間の記事一覧

SRM 580 div2

1015 -> 1115 (+100) DIV1にあと2回ぐらいでなりたいeasy すべてのうさぎの組み合わせに対して、時間が重なっているかどうかをみるだけ #include <cstdio> #include <vector> #include <string> #include <algorithm> using namespace std; class ShoutterDiv2{ public: int count(vector <int> s, ve</int></algorithm></string></vector></cstdio>…

AOJ 0270 モジュロ・クエリ

AOJ

問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0270 解法 去年のパソコン甲子園の問題。去年の本選のとき解けなかった。 解説にのっているやり方とはちょっと違うやり方でやった。 アルゴリズムは解説のものより log N 倍ぐらい遅いはずだ…

AOJ 0230

問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0230 解法 幅優先探索(BFS)する はしごを登ったり、滑ったりする処理をミスってバグりまくった #include <cstdio> #include <algorithm> #include <queue> using namespace std; typedef pair<int, int> P; typedef pair<P, int> PP; in</p,></int,></queue></algorithm></cstdio>…

AOJ 0032

AOJ

D言語を使う練習として解いた D言語っぽいことはやっていない import std.stdio; import std.array; import std.conv; void main(){ bool[60000] p; p[0] = false; p[1] = false; for(int i = 0; i < 60000; i++) p[i] = true; for(int i = 2; i * i < 60000…

SRM 310 div1

easyだけ解いた 二分探索してレベルを決定して、コーナーケースに気をつけながら表面積を計算する。 コーナーケースありすぎorz #include <cstdio> #include <algorithm> #include <vector> #include <string> using namespace std; typedef long long ll; class PyramidOfCubes{ public: ll k; </string></vector></algorithm></cstdio>…

SRM 578 div2

917->1014 DIV2で59位でした。easy #include <cstdio> #include <algorithm> #include <vector> #include <string> using namespace std; class DeerInZooDivTwo{ public: vector <int> getminmax(int N, int K){ vector<int> ans; ans.push_back(max(0, N - K)); ans.push_back(N - (K + 1) / 2); return </int></int></string></vector></algorithm></cstdio>…