結果

問題 No.2923 Mayor's Job
ユーザー startcpp
提出日時 2024-10-12 16:16:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 918 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 83,428 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 16:16:19
合計ジャッジ時間 1,543 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int n, K;
int h[2000];
int x[2000], y[2000];
int inV[2000];

signed main() {
    int i, j;

    cin >> n >> K;
    rep(i, n) cin >> h[i];
    rep(i, n) cin >> x[i] >> y[i];
    rep(i, n) {
        for (j = i + 1; j < n; j++) {
            int dx = x[j] - x[i];
            int dy = y[j] - y[i];
            if (dx * dx + dy * dy <= K * K) {
                if (h[i] > h[j]) {
                    inV[j]++;
                }
                else if (h[i] < h[j]) inV[i]++;
            }
        }
    }

    int ans = 0;
    rep(i, n) if (inV[i] == 0) ans++;

    cout << ans << endl;
    return 0;
}
0