結果

問題 No.1121 Social Distancing in Cinema
ユーザー nebukuro09nebukuro09
提出日時 2020-07-22 22:37:10
言語 D
(dmd 2.106.1)
結果
TLE  
実行時間 -
コード長 1,570 bytes
コンパイル時間 1,160 ms
コンパイル使用メモリ 142,460 KB
実行使用メモリ 26,084 KB
最終ジャッジ日時 2023-09-04 08:38:31
合計ジャッジ時間 11,235 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
11,488 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 11 ms
4,380 KB
testcase_16 AC 82 ms
5,944 KB
testcase_17 AC 829 ms
13,552 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdlib, std.datetime;

void main() {
    auto N = readln.chomp.to!int;
    auto A = iota(N).map!(i => readln.split.map!(to!int).array ~ i.to!int).array;

    int[] ans;

    A.sort!((a, b) => a[0] == b[0] ? a[1] < b[1] : a[0] < b[0]);
    ans = solve(N, A);
    if (!ans.empty) {
        ans.length.writeln;
        ans.map!(a => (a + 1).to!string).join(" ").writeln;
        return;
    }

    A.sort!((a, b) => a[0] == b[0] ? a[1] > b[1] : a[0] > b[0]);
    ans = solve(N, A);
    if (!ans.empty) {
        ans.length.writeln;
        ans.map!(a => (a + 1).to!string).join(" ").writeln;
        return;
    }

    A.sort!((a, b) => a[1] == b[1] ? a[0] < b[0] : a[1] < b[1]);
    ans = solve(N, A);
    if (!ans.empty) {
        ans.length.writeln;
        ans.map!(a => (a + 1).to!string).join(" ").writeln;
        return;
    }

    A.sort!((a, b) => a[1] == b[1] ? a[0] > b[0] : a[1] > b[1]);
    ans = solve(N, A);
    if (!ans.empty) {
        ans.length.writeln;
        ans.map!(a => (a + 1).to!string).join(" ").writeln;
        return;
    }
}

int[] solve(int N, const int[][] A) {
    int[] ans;

    outer: foreach (i; 0..N) {
        foreach (a; ans) if ((A[i][0] - A[a][0])^^2 + (A[i][1] - A[a][1])^^2 < 100) {
            continue outer;
        }
        ans ~= i;
    }

    if (ans.length * 90 >= N) {
        return ans;
    } else {
        return [];
    }
}
0