結果

問題 No.202 1円玉投げ
ユーザー kakira9618
提出日時 2015-05-04 00:50:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 1,615 bytes
コンパイル時間 1,027 ms
コンパイル使用メモリ 93,680 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-12-22 07:53:35
合計ジャッジ時間 3,845 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
using namespace std;
struct coin{
int id;
int x;
int y;
};
bool check(coin &a, coin &b) {
int dx = a.x - b.x;
int dy = a.y - b.y;
return (dx * dx + dy * dy) < 400;
}
bool dame(int x, int y) {
return x < 0 || x >= 201 || y < 0 || y >= 201;
}
int main(int argc, char const *argv[]) {
int N;
cin >> N;
vector<coin> coins[201][201];
std::vector<int> flag(N, 0);
for (int i = 0; i < N; i++) {
int x, y;
cin >> x >> y;
int px = x / 100;
int py = y / 100;
coin tgt = (coin){i, x, y};
bool flag = false;
for (int i = -1 ; i <= 1; i++) {
for (int j = -1 ; j <= 1; j++) {
if (dame(px + i, py + j)) continue;
for (int k = 0; k < coins[px + i][py + j].size(); k++) {
if (check(coins[px + i][py + j][k], tgt)) {
flag = true;
}
}
}
}
if (!flag) {
coins[px][py].push_back(tgt);
}
}
int ans = 0;
for (int i = 0; i < 201; i++) {
for (int j = 0; j < 201; j++) {
ans += coins[i][j].size();
}
}
cout << ans << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0