2011-01-25から1日間の記事一覧

Codeforces Beta Round #53 C. Array

Array2nCn-n。 小さいnに対して実際に調べて、OEISに訊いた。 理由を考えてみる。n個の数字からn個を選ぶ重複組合せは2n-1Cn通り。選んだ数字を昇順と降順に並べることでbeautiful arrayが得られる。22n-1Cn=2nCn通り。ただし、これは全てが同じ数字の数列を…

Codeforces Beta Round #53 B. Martian Architecture

Martian ArchitectureChrisが興味を持っている場所だけ調べる。PythonだとTLE。 #include <iostream> #include <vector> using namespace std; int main() { int n,m,k; cin >> n >> m >> k; vector<int> a(m), b(m), c(m); for ( int i=0; i<m; i++ ) cin >> a[i] >> b[i] >> c[i]; long long ans </m;></int></vector></iostream>…

Codeforces Beta Round #53 A. Square Earth?

Square Earth? def d(n,x,y): if y==0: return x if x==n: return n+y if y==n: return 3*n-x if x==0: return 4*n-y return -1 n,x1,y1,x2,y2 = map(int,raw_input().split()) d1 = d(n,x1,y1) d2 = d(n,x2,y2) print min(abs(d2-d1),4*n-abs(d2-d1))

Codeforces Beta Round #53

A 482 B 860 C 1128 Hack +100 Cでn≦100000のところn≦1000と勘違いしている人が居たのでHack。 結果 59位 1856 → 1944 (`・ω・´)