結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 572 ms
11,144 KB
testcase_02 AC 6 ms
5,924 KB
testcase_03 AC 6 ms
6,004 KB
testcase_04 WA -
testcase_05 AC 32 ms
6,212 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 426 ms
11,284 KB
testcase_18 AC 427 ms
11,292 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 10 ms
5,948 KB
testcase_23 AC 10 ms
6,012 KB
testcase_24 AC 7 ms
5,872 KB
testcase_25 AC 9 ms
6,028 KB
testcase_26 WA -
testcase_27 AC 9 ms
5,948 KB
testcase_28 WA -
testcase_29 AC 8 ms
6,036 KB
testcase_30 AC 10 ms
5,864 KB
testcase_31 AC 8 ms
5,880 KB
testcase_32 AC 11 ms
5,880 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 412 ms
11,308 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 7 ms
5,956 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].lower_bound(low) < high){
                ok = false;
                break;
            }
        }
        if(ok){
            ys[X[i]].emplace(Y[i]);
            ans += 1;
        }
    }

    cout << ans << endl;

    return 0;
}
0