結果

問題 No.202 1円玉投げ
ユーザー simansiman
提出日時 2016-03-27 23:51:48
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,280 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 76,864 KB
実行使用メモリ 30,232 KB
最終ジャッジ日時 2023-08-23 23:20:04
合計ジャッジ時間 7,236 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 11 ms
26,852 KB
testcase_03 AC 12 ms
26,904 KB
testcase_04 AC 11 ms
27,028 KB
testcase_05 AC 16 ms
27,096 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 16 ms
27,124 KB
testcase_15 RE -
testcase_16 AC 71 ms
30,160 KB
testcase_17 AC 68 ms
30,020 KB
testcase_18 AC 69 ms
29,944 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 12 ms
26,888 KB
testcase_23 RE -
testcase_24 AC 11 ms
27,028 KB
testcase_25 RE -
testcase_26 AC 12 ms
26,848 KB
testcase_27 RE -
testcase_28 AC 12 ms
27,036 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 12 ms
26,816 KB
testcase_32 AC 11 ms
26,848 KB
testcase_33 RE -
testcase_34 AC 12 ms
26,844 KB
testcase_35 AC 69 ms
29,944 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 73 ms
30,232 KB
testcase_39 AC 12 ms
26,808 KB
testcase_40 AC 11 ms
26,808 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 || 2001 <= curY || curX < 0 || 2001 <= 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