結果

問題 No.202 1円玉投げ
ユーザー 沙耶花沙耶花
提出日時 2021-11-04 18:26:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 1,051 bytes
コンパイル時間 4,158 ms
コンパイル使用メモリ 262,344 KB
実行使用メモリ 5,336 KB
最終ジャッジ日時 2023-08-24 00:23:45
合計ジャッジ時間 7,667 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
5,000 KB
testcase_01 AC 113 ms
5,336 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 7 ms
4,376 KB
testcase_06 AC 111 ms
4,896 KB
testcase_07 AC 124 ms
5,248 KB
testcase_08 AC 127 ms
5,208 KB
testcase_09 AC 67 ms
4,656 KB
testcase_10 AC 27 ms
4,376 KB
testcase_11 AC 55 ms
4,544 KB
testcase_12 AC 55 ms
4,456 KB
testcase_13 AC 29 ms
4,452 KB
testcase_14 AC 9 ms
4,376 KB
testcase_15 AC 65 ms
4,728 KB
testcase_16 AC 69 ms
4,920 KB
testcase_17 AC 71 ms
5,076 KB
testcase_18 AC 71 ms
5,000 KB
testcase_19 AC 60 ms
4,472 KB
testcase_20 AC 98 ms
5,000 KB
testcase_21 AC 59 ms
4,476 KB
testcase_22 AC 3 ms
4,384 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 3 ms
4,376 KB
testcase_30 AC 3 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 3 ms
4,376 KB
testcase_34 AC 3 ms
4,376 KB
testcase_35 AC 73 ms
4,732 KB
testcase_36 AC 78 ms
4,912 KB
testcase_37 AC 138 ms
5,124 KB
testcase_38 AC 78 ms
4,920 KB
testcase_39 AC 2 ms
4,376 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=-20;i<=20;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