結果

問題 No.1121 Social Distancing in Cinema
ユーザー 👑 jupirojupiro
提出日時 2020-07-22 23:01:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,228 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 140,352 KB
実行使用メモリ 20,888 KB
最終ジャッジ日時 2023-09-05 03:30:26
合計ジャッジ時間 14,331 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 5 ms
4,380 KB
testcase_16 AC 21 ms
5,564 KB
testcase_17 AC 167 ms
10,944 KB
testcase_18 AC 499 ms
17,872 KB
testcase_19 AC 665 ms
20,888 KB
testcase_20 AC 5 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 4 ms
4,380 KB
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 42 ms
7,552 KB
testcase_26 AC 66 ms
9,308 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 525 ms
18,356 KB
testcase_29 AC 59 ms
8,744 KB
testcase_30 AC 62 ms
7,520 KB
testcase_31 AC 664 ms
20,728 KB
testcase_32 AC 403 ms
16,416 KB
testcase_33 AC 94 ms
8,868 KB
testcase_34 AC 93 ms
8,784 KB
testcase_35 AC 443 ms
17,032 KB
testcase_36 AC 641 ms
19,920 KB
testcase_37 AC 56 ms
7,292 KB
testcase_38 AC 120 ms
9,816 KB
testcase_39 AC 545 ms
18,104 KB
testcase_40 AC 30 ms
6,212 KB
testcase_41 AC 7 ms
4,508 KB
testcase_42 AC 597 ms
19,936 KB
testcase_43 AC 597 ms
20,072 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 AC 2 ms
4,388 KB
testcase_48 AC 1 ms
4,380 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 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();
    for (int i = 0; i < n; i++) {
        if (x[i] == x[idx] and y[i] < y[idx]) {
            idx = i;
        }
    }
    set<tuple<int, int, int>> s; for (int i = 0; i < n; i++) s.emplace(x[i], y[i], i);
    vector<int> res;
    res.emplace_back(idx);
    s.erase(s.find(make_tuple(x[idx], y[idx], idx)));
    while (res.size() < k) {
        if (s.empty()){
            assert(false);
        }
        auto [t1,t2, p] = *s.begin();
        s.erase(s.begin());
        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()];
    return 0;
}
0