結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2015-05-05 01:33:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 5,000 ms |
| コード長 | 1,026 bytes |
| コンパイル時間 | 982 ms |
| コンパイル使用メモリ | 73,720 KB |
| 実行使用メモリ | 10,112 KB |
| 最終ジャッジ日時 | 2024-12-22 08:31:00 |
| 合計ジャッジ時間 | 4,227 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <algorithm>
#include <sstream>
#include <set>
#include <vector>
#include <cstdio>
using namespace std;
typedef pair<int, int> II;
typedef set<II> IISet;
int main(int argc, char *argv[])
{
string s;
getline(cin, s);
int N = atoi(s.c_str());
int ans = 0;
IISet coins[202][202];
for (int i = 0; i < N; ++i) {
getline(cin, s);
stringstream ss(s);
int x, y;
ss >> x >> y;
int sx = (x - 20 + 50) / 100;
int ex = (x + 20 + 50) / 100;
int sy = (y - 20 + 50) / 100;
int ey = (y + 20 + 50) / 100;
bool remove = false;
for (int i = sy; i <= ey; ++i) {
for (int j = sx; j <= ex; ++j) {
IISet &a = coins[i][j];
IISet::const_iterator it;
for (it = a.begin(); it != a.end(); ++it) {
int dx = it->first - x;
int dy = it->second - y;
if ((dx * dx + dy * dy) < 20 * 20) {
remove = true;
break;
}
}
}
}
if (!remove) {
coins[(y + 50) / 100][(x + 50) / 100].insert(II(x, y));
++ans;
}
}
cout << ans << endl;
return 0;
}
hotpepsi