2010-04-12から1日間の記事一覧

PKU 3138 ACM Team Selection

素直に実装するのみ 問題文を読み間違えて1WA int main() { int caseIndex = 0; for (int S, T, M; cin >> S >> T >> M && (S || T || M); ) { int counter[128][3]; memset(counter, 0, sizeof(counter)); for (int s = 0; s < S; ++s) { int Id; cin >> Id…

PKU 2002 Squares

2点をfor文で回す 対応する残り2点が存在するかどうかをlog(N)で調べる int main() { for (int n; cin >> n && n; ) { set<pair<int, int> > positionSet; vector<pair<int, int> > positions; for (int i = 0; i < n; ++i) { int x, y; cin >> x >> y; positions.push_back(make_pair(x, y</pair<int,></pair<int,>…

PKU 1477 Box of Bricks

全部同じ高さになるように移動するのみ int main() { int caseIndex = 0; for (int n; cin >> n && n; ) { vector<int> heights; int sum = 0; for (int i = 0; i < n; ++i) { int height; cin >> height; heights.push_back(height); sum += height; } const int</int>…