2012-09-01から1ヶ月間の記事一覧

JOI春合宿2008Day2 cheating

JOI

適当ににぶたんすると通る 問題文読み間違って無駄に難しくしてた... #include <cstdio> #include <algorithm> #include <climits> using namespace std; int n, m; int x[100000], y[100000]; bool C(int k){ int crt = -INT_MAX, num = 0; for(int i = 0; i < m && num <= n; i++){ if(</climits></algorithm></cstdio>…

AOJ0563 Walking Santa

AIZU ONLINE JUDGE 少し考えると始点の選び方の候補が絞られることがわかる。 nが奇数の時は1箇所に決まるが、偶数の時は4通り調べる。 偶数の時に2通りしか調べなかったり、答える座標が適切でなかったりしてわ〜してた。 #include <cstdio> #include <algorithm> #include <cstring> #i</cstring></algorithm></cstdio>…

AOJ0535 Crossing Black Ice

まあ深さ優先するだけ簡単だけど一発で通って嬉しかった 10分 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int m, n, ans; int dx[] = {-1, 1, 0, 0}; int dy[] = {0, 0, -1, 1}; int ice[100][100]; bool vis[100][100]; bool in(int x, int y){ r</algorithm></cstring></cstdio>…

AOJ0569 Illumination

AOJ0569 AIZU ONLINE JUDGE適当にdfsするとできた 前の予選の時は全然出来なかったなあ。 #include <cstdio> using namespace std; int w, h, ans; int bu[110][110]; bool used[110][110]; int dx[2][6] = {{-1,-1,0,1,0,-1}, {-1, 0, 1, 1, 1, 0}}; int dy[6] = {0</cstdio>…