結果

問題 No.202 1円玉投げ
ユーザー not_522not_522
提出日時 2015-08-17 12:23:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 594 ms / 5,000 ms
コード長 1,221 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 155,336 KB
実行使用メモリ 58,652 KB
最終ジャッジ日時 2023-08-23 23:09:51
合計ジャッジ時間 9,598 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 215 ms
14,460 KB
testcase_01 AC 503 ms
58,652 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 25 ms
7,576 KB
testcase_06 AC 502 ms
46,692 KB
testcase_07 AC 562 ms
50,100 KB
testcase_08 AC 578 ms
50,448 KB
testcase_09 AC 296 ms
34,008 KB
testcase_10 AC 113 ms
17,964 KB
testcase_11 AC 238 ms
29,620 KB
testcase_12 AC 249 ms
30,292 KB
testcase_13 AC 125 ms
19,360 KB
testcase_14 AC 30 ms
8,336 KB
testcase_15 AC 276 ms
33,224 KB
testcase_16 AC 163 ms
17,564 KB
testcase_17 AC 198 ms
17,532 KB
testcase_18 AC 201 ms
17,588 KB
testcase_19 AC 263 ms
31,648 KB
testcase_20 AC 435 ms
43,568 KB
testcase_21 AC 257 ms
31,584 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 3 ms
4,376 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 3 ms
4,376 KB
testcase_30 AC 3 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 5 ms
4,380 KB
testcase_33 AC 3 ms
4,380 KB
testcase_34 AC 3 ms
4,376 KB
testcase_35 AC 187 ms
14,392 KB
testcase_36 AC 159 ms
14,612 KB
testcase_37 AC 594 ms
52,492 KB
testcase_38 AC 191 ms
14,612 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

template<typename T> inline T gcd(T a, T b) {
  return __gcd(a, b);
}

template<typename T> inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}

template<typename T> inline T floor(T a, T b) {
  return floor(a / b) * b <= a ? floor(a / b) : floor(a / b) - 1;
}

template<typename T> inline T ceil(T a, T b) {
  return floor(a + b - 1, b);
}

template<typename T> inline T round(T a, T b) {
  return floor(a + b / 2);
}

template<typename T> inline T mod(T a, T b) {
  return a - floor(a, b) * b;
}

template<typename T> inline T factorial(T n) {
  return n <= 1 ? 1 : factorial(n - 1) * n;
}

int main() {
  int n;
  cin >> n;
  map<pair<int, int>, vector<pair<int, int>>> c;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    int a = floor(x, 20), b = floor(y, 20);
    bool ok = true;
    for (int i = a - 1; i <= a + 1; ++i) {
      for (int j = b - 1; j <= b + 1; ++j) {
        for (auto k : c[make_pair(i, j)]) {
          if (pow(x - k.first, 2) + pow(y - k.second, 2) < 400) ok = false;
        }
      }
    }
    if (ok) {
      c[make_pair(a, b)].emplace_back(make_pair(x, y));
      ++res;
    }
  }
  cout << res << endl;
}
0