結果

問題 No.202 1円玉投げ
ユーザー outlineoutline
提出日時 2021-02-14 17:13:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 660 ms / 5,000 ms
コード長 2,216 bytes
コンパイル時間 1,360 ms
コンパイル使用メモリ 141,836 KB
実行使用メモリ 11,308 KB
最終ジャッジ日時 2023-08-24 00:20:13
合計ジャッジ時間 11,825 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 437 ms
11,156 KB
testcase_01 AC 592 ms
11,152 KB
testcase_02 AC 6 ms
6,028 KB
testcase_03 AC 6 ms
5,996 KB
testcase_04 AC 6 ms
6,028 KB
testcase_05 AC 33 ms
6,128 KB
testcase_06 AC 525 ms
9,832 KB
testcase_07 AC 594 ms
10,440 KB
testcase_08 AC 592 ms
10,416 KB
testcase_09 AC 279 ms
8,672 KB
testcase_10 AC 109 ms
7,004 KB
testcase_11 AC 224 ms
8,120 KB
testcase_12 AC 239 ms
8,192 KB
testcase_13 AC 122 ms
7,208 KB
testcase_14 AC 37 ms
6,236 KB
testcase_15 AC 269 ms
8,592 KB
testcase_16 AC 417 ms
11,288 KB
testcase_17 AC 422 ms
11,228 KB
testcase_18 AC 422 ms
11,216 KB
testcase_19 AC 250 ms
8,384 KB
testcase_20 AC 426 ms
9,648 KB
testcase_21 AC 253 ms
8,380 KB
testcase_22 AC 10 ms
5,872 KB
testcase_23 AC 10 ms
5,968 KB
testcase_24 AC 7 ms
5,872 KB
testcase_25 AC 9 ms
5,952 KB
testcase_26 AC 8 ms
6,012 KB
testcase_27 AC 9 ms
5,996 KB
testcase_28 AC 8 ms
5,948 KB
testcase_29 AC 8 ms
6,032 KB
testcase_30 AC 10 ms
5,892 KB
testcase_31 AC 8 ms
5,936 KB
testcase_32 AC 10 ms
5,968 KB
testcase_33 AC 9 ms
5,960 KB
testcase_34 AC 10 ms
5,928 KB
testcase_35 AC 425 ms
11,296 KB
testcase_36 AC 417 ms
11,208 KB
testcase_37 AC 660 ms
10,640 KB
testcase_38 AC 426 ms
11,308 KB
testcase_39 AC 6 ms
5,968 KB
testcase_40 AC 6 ms
5,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
using namespace std;

using ll = long long;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    for(int i = 0; i < N; ++i)  cin >> X[i] >> Y[i];

    vector<set<int>> ys(20001);
    for(int i = 0; i <= 20000; ++i){
        ys[i].emplace(-1000);
        ys[i].emplace(21000);
    }
    
    int ans = 0;
    for(int i = 0; i < N; ++i){
        bool ok = true;
        for(int x = max(0, X[i] - 19); x <= min(20000, X[i] + 19); ++x){
            int dx = X[i] - x;
            int lb = -1000, ub = Y[i];
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                int dy = abs(mid - Y[i]);
                if(dx * dx + dy * dy >= 400)    lb = mid;
                else    ub = mid;
            }
            int low = lb;
            lb = Y[i], ub = 21000;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                int dy = abs(mid - Y[i]);
                if(dx * dx + dy * dy >= 400)    ub = mid;
                else    lb = mid;
            }
            int high = ub;
            if(*ys[x].upper_bound(low) < high){
                ok = false;
                break;
            }
        }
        if(ok){
            ys[X[i]].emplace(Y[i]);
            ans += 1;
        }
    }

    cout << ans << endl;

    return 0;
}
0