結果

問題 No.1121 Social Distancing in Cinema
ユーザー 👑 jupirojupiro
提出日時 2020-07-22 23:14:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,644 bytes
コンパイル時間 3,508 ms
コンパイル使用メモリ 136,016 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2023-09-05 04:14:44
合計ジャッジ時間 16,869 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 4 ms
4,384 KB
testcase_21 AC 3 ms
4,384 KB
testcase_22 AC 3 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 24 ms
4,440 KB
testcase_26 AC 42 ms
4,508 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 464 ms
6,308 KB
testcase_29 AC 37 ms
4,556 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 40 ms
4,384 KB
testcase_38 AC 96 ms
4,664 KB
testcase_39 AC 469 ms
6,148 KB
testcase_40 AC 19 ms
4,384 KB
testcase_41 AC 5 ms
4,380 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 1 ms
4,380 KB
testcase_48 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int d(int x1, int y1, int x2, int y2) {
    return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

void f(vector<int>& res, vector<int>& v, int k, vector<int> &x, vector<int> &y) {
    while (res.size() < k) {
        if (v.empty()) {
            return;
        }
        int p = v.back();
        v.pop_back();
        bool ok = true;
        for (auto e : res) {
            int len2 = (x[e] - x[p]) * (x[e] - x[p]) + (y[e] - y[p]) * (y[e] - y[p]);
            if (len2 < 100) {
                ok = false;
                break;
            }
        }
        if (ok) res.emplace_back(p);
    }
    cout << res.size() << "\n";
    for (int i = 0; i < res.size(); i++) cout << res[i] + 1 << " \n"[i + 1 == res.size()];
    exit(0);
}
int main()
{
    /*
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    */

    int n; scanf("%d", &n);
    int k = (n + 89) / 90;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]);
    {
        int idx = min_element(x.begin(), x.end()) - x.begin();
        vector<int> v;
        for (int i = 0; i < n; i++) if (i != idx) v.emplace_back(i);
        sort(v.begin(), v.end(), [&](int i, int j) {return x[i] < x[j]; });
        reverse(v.begin(), v.end());
        vector<int> res; res.emplace_back(idx);
        f(res, v, k, x, y);
    }
    {
        int idx = rnd() % n;
        vector<int> v;
        for (int i = 0; i < n; i++) if (i != idx) v.emplace_back(i);
        shuffle(v.begin(), v.end(), rnd);
        vector<int> res; res.emplace_back(idx);
        f(res, v, k, x, y);
    }

    return 0;
}
0