結果

問題 No.202 1円玉投げ
ユーザー simansiman
提出日時 2016-03-27 23:54:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 1,280 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 76,744 KB
実行使用メモリ 30,128 KB
最終ジャッジ日時 2023-08-23 23:19:47
合計ジャッジ時間 4,171 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
30,068 KB
testcase_01 AC 91 ms
29,924 KB
testcase_02 AC 12 ms
26,832 KB
testcase_03 AC 12 ms
26,852 KB
testcase_04 AC 12 ms
27,032 KB
testcase_05 AC 17 ms
27,024 KB
testcase_06 AC 78 ms
29,328 KB
testcase_07 AC 84 ms
29,452 KB
testcase_08 AC 85 ms
29,444 KB
testcase_09 AC 52 ms
28,348 KB
testcase_10 AC 28 ms
27,544 KB
testcase_11 AC 45 ms
28,152 KB
testcase_12 AC 46 ms
28,132 KB
testcase_13 AC 30 ms
27,636 KB
testcase_14 AC 18 ms
27,112 KB
testcase_15 AC 51 ms
28,276 KB
testcase_16 AC 72 ms
29,964 KB
testcase_17 AC 69 ms
30,116 KB
testcase_18 AC 70 ms
30,024 KB
testcase_19 AC 49 ms
28,340 KB
testcase_20 AC 70 ms
28,916 KB
testcase_21 AC 48 ms
28,200 KB
testcase_22 AC 12 ms
26,860 KB
testcase_23 AC 12 ms
26,876 KB
testcase_24 AC 12 ms
26,844 KB
testcase_25 AC 12 ms
26,908 KB
testcase_26 AC 13 ms
26,848 KB
testcase_27 AC 13 ms
27,152 KB
testcase_28 AC 13 ms
26,972 KB
testcase_29 AC 13 ms
26,824 KB
testcase_30 AC 13 ms
26,996 KB
testcase_31 AC 12 ms
26,844 KB
testcase_32 AC 13 ms
27,004 KB
testcase_33 AC 12 ms
26,916 KB
testcase_34 AC 13 ms
26,864 KB
testcase_35 AC 69 ms
29,948 KB
testcase_36 AC 74 ms
30,092 KB
testcase_37 AC 91 ms
29,672 KB
testcase_38 AC 74 ms
30,128 KB
testcase_39 AC 12 ms
27,036 KB
testcase_40 AC 12 ms
26,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <limits.h>
#include <time.h>
#include <string>
#include <string.h>
#include <sstream>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

struct Coord {
  int y;
  int x;
  
  Coord(int y = -1, int x = -1){
    this->y = y;
    this->x = x;
  }
};

vector<Coord> field[1001][1001];

int main(){
  int n;
  cin >> n;

  int x, y;
  int cnt = 0;
  for(int i = 0; i < n; i++){
    cin >> x >> y;

    int cy = y/20;
    int cx = x/20;
    bool success = true;

    for(int curY = cy-1; curY <= cy+1 && success; curY++){
      for(int curX = cx-1; curX <= cx+1 && success; curX++){
        if(curY < 0 || 1001 <= curY || curX < 0 || 1001 <= curX) continue;
        int size = field[curY][curX].size();

        for(int j = 0; j < size; j++){
          Coord coord = field[curY][curX][j];

          int dy = coord.y - y;
          int dx = coord.x - x;
          int dist = dy*dy + dx*dx;

          if(dist < 400){
            success = false;
          }
        }
      }
    }

    if(success){
      field[cy][cx].push_back(Coord(y,x));
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}
0