結果

問題 No.202 1円玉投げ
ユーザー 沙耶花沙耶花
提出日時 2022-09-23 03:27:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 1,051 bytes
コンパイル時間 4,265 ms
コンパイル使用メモリ 260,696 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2023-08-24 00:25:42
合計ジャッジ時間 7,305 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
5,188 KB
testcase_01 AC 112 ms
5,128 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 7 ms
4,376 KB
testcase_06 AC 112 ms
4,916 KB
testcase_07 AC 126 ms
5,128 KB
testcase_08 AC 127 ms
5,248 KB
testcase_09 AC 66 ms
4,652 KB
testcase_10 AC 26 ms
4,448 KB
testcase_11 AC 54 ms
4,460 KB
testcase_12 AC 56 ms
4,376 KB
testcase_13 AC 29 ms
4,380 KB
testcase_14 AC 8 ms
4,380 KB
testcase_15 AC 64 ms
4,664 KB
testcase_16 AC 71 ms
4,928 KB
testcase_17 AC 71 ms
4,876 KB
testcase_18 AC 70 ms
4,936 KB
testcase_19 AC 60 ms
4,380 KB
testcase_20 AC 99 ms
5,248 KB
testcase_21 AC 60 ms
4,388 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 70 ms
4,648 KB
testcase_36 AC 76 ms
4,940 KB
testcase_37 AC 138 ms
5,128 KB
testcase_38 AC 74 ms
4,812 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000000000
	

int main(){	
	
	int N;
	cin>>N;
	
	vector<int> x(N),y(N);
	vector<vector<int>> inds(20003);
	
	vector<int> dy,dx;
	for(int i=-19;i<=19;i++){
		dy.push_back(i);
		rep(j,10000){
			if(i*i + j*j >= 400){
				dx.push_back(j-1);
				break;
			}
		}
	}
	rep(i,N){
		cin>>x[i]>>y[i];
		bool f = true;
		rep(j,dy.size()){
			int xx = x[i] + dy[j];
			if(xx<0||xx>=20002)continue;
			int d = distance(inds[xx].begin(),lower_bound(inds[xx].begin(),inds[xx].end(),y[i]-dx[j]));
			
			if(d==inds[xx].size())continue;
			if(inds[xx][d]>y[i]+dx[j])continue;
			f = false;
			break;
		}
		if(f){
			int d = distance(inds[x[i]].begin(),lower_bound(inds[x[i]].begin(),inds[x[i]].end(),y[i]));
			inds[x[i]].insert(inds[x[i]].begin()+d,y[i]);
		}
		
	}
	int ans = 0;
	rep(i,inds.size())ans += inds[i].size();
	
	cout<<ans<<endl;
	
	return 0;
	
}
0