結果

問題 No.2923 Mayor's Job
ユーザー elphe
提出日時 2024-10-24 16:26:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 1,001 bytes
コンパイル時間 855 ms
コンパイル使用メモリ 84,252 KB
最終ジャッジ日時 2025-02-24 22:37:46
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	uint16_t N, i, j;
	int32_t K;
	cin >> N >> K;
	vector<tuple<uint32_t, int32_t, int32_t>> shrines(N);
	for (i = 0; i != N; ++i) cin >> get<0>(shrines[i]);
	for (i = 0; i != N; ++i) cin >> get<1>(shrines[i]) >> get<2>(shrines[i]);

	sort(shrines.begin(), shrines.end());
	uint16_t count_deleted = 0;
	vector<bool> is_deleted(N, false);
	for (i = 0; i != N; ++i)
		if (!is_deleted[i])
			for (j = 0; j != i; ++j)
				if (!is_deleted[j] && get<0>(shrines[i]) != get<0>(shrines[j]) && static_cast<int64_t>(get<1>(shrines[i]) - get<1>(shrines[j])) * (get<1>(shrines[i]) - get<1>(shrines[j])) + static_cast<int64_t>(get<2>(shrines[i]) - get<2>(shrines[j])) * (get<2>(shrines[i]) - get<2>(shrines[j])) <= static_cast<int64_t>(K) * K)
					is_deleted[j] = true, ++count_deleted;

	cout << N - count_deleted << '\n';
	return 0;
}
0