結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 421 ms
11,208 KB
testcase_01 AC 579 ms
11,224 KB
testcase_02 AC 6 ms
6,008 KB
testcase_03 AC 5 ms
6,012 KB
testcase_04 AC 6 ms
5,864 KB
testcase_05 WA -
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 AC 389 ms
11,304 KB
testcase_17 AC 412 ms
11,176 KB
testcase_18 AC 412 ms
11,244 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 9 ms
6,112 KB
testcase_23 AC 9 ms
6,012 KB
testcase_24 AC 7 ms
5,864 KB
testcase_25 AC 8 ms
5,876 KB
testcase_26 AC 8 ms
5,948 KB
testcase_27 AC 8 ms
6,024 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 10 ms
5,952 KB
testcase_31 AC 8 ms
6,004 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 10 ms
5,948 KB
testcase_35 AC 409 ms
11,276 KB
testcase_36 AC 387 ms
11,228 KB
testcase_37 WA -
testcase_38 AC 410 ms
11,140 KB
testcase_39 AC 6 ms
5,884 KB
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

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(-100);
        ys[i].emplace(20100);
    }
    
    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 = -100, ub = Y[i];
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                int dy = abs(mid - Y[i]);
                if(dx * dx + dy * dy >= 100)    lb = mid;
                else    ub = mid;
            }
            int low = lb;
            lb = Y[i], ub = 20100;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                int dy = abs(mid - Y[i]);
                if(dx * dx + dy * dy >= 100)    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