codeforces#39

はぁ〜

テンション下がりました

0:14:16 A pretest通過

0:52:37 C pretest通過

DとかEとか, 問題わかって面白そうだなーと眺めながらぼーとしてた

そしたら...

1:45:15 C Hacked

あー時間制限のハックだ...

うにょー

結果

A Accepted

C Time limit exceeded on hack 1



Aはxorとったらすぐだろ

from math import sqrt
(x, y) = map(float, raw_input().split())
r = sqrt(x**2 + y**2)
print 'white' if r != int(r) and (int(r) % 2 == 0) ^ (y / x > 0) else 'black'



Cはこんな感じなの

(n, x, m, y) = map(int, raw_input().split())
ans, d = 2, abs(x - y)
for i in xrange(1, n + 1):
  ans += 2 * max(min(m, d + i - 1) - max(0, abs(d - i)), 0)
  ans += 1 if 1 <= d + i <= m else 0
  ans += 1 if 1 <= abs(d - i) <= m else 0
print ans

これってnの方のループを回さないでも計算でき...出来そうですねー

うん, 何時か考えよう...