結果

問題 No.759 悪くない忘年会にしような!
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-04-05 15:09:45
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 2,855 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 117,956 KB
実行使用メモリ 13,776 KB
最終ジャッジ日時 2023-09-04 00:21:29
合計ジャッジ時間 7,301 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 11 ms
4,384 KB
testcase_34 AC 3 ms
4,376 KB
testcase_35 AC 7 ms
4,380 KB
testcase_36 AC 12 ms
4,384 KB
testcase_37 AC 3 ms
4,384 KB
testcase_38 AC 13 ms
4,380 KB
testcase_39 AC 4 ms
4,380 KB
testcase_40 AC 10 ms
4,376 KB
testcase_41 AC 11 ms
5,320 KB
testcase_42 AC 12 ms
4,380 KB
testcase_43 AC 13 ms
4,376 KB
testcase_44 AC 119 ms
6,784 KB
testcase_45 AC 117 ms
5,468 KB
testcase_46 AC 118 ms
7,304 KB
testcase_47 AC 121 ms
13,776 KB
testcase_48 AC 118 ms
6,516 KB
testcase_49 AC 14 ms
4,376 KB
testcase_50 AC 14 ms
4,376 KB
testcase_51 AC 13 ms
4,376 KB
testcase_52 AC 14 ms
4,384 KB
testcase_53 AC 120 ms
12,716 KB
testcase_54 AC 122 ms
12,752 KB
testcase_55 AC 117 ms
5,520 KB
testcase_56 AC 118 ms
5,948 KB
testcase_57 AC 116 ms
6,000 KB
testcase_58 AC 117 ms
5,488 KB
testcase_59 AC 118 ms
6,280 KB
testcase_60 AC 115 ms
5,992 KB
testcase_61 AC 116 ms
5,568 KB
testcase_62 AC 120 ms
13,704 KB
testcase_63 AC 129 ms
7,048 KB
testcase_64 AC 129 ms
6,476 KB
testcase_65 AC 105 ms
5,528 KB
testcase_66 AC 130 ms
5,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.conv, std.functional, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.numeric, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


enum LIM = 10^^4;

int[] bit;
void update(int pos, int val) {
  for (int x = pos; x < bit.length; x |= x + 1) {
    chmin(bit[x], val);
  }
}
int rangeMin(int pos) {
  int mn = LIM + 1;
  for (int x = pos - 1; x >= 0; x = (x & (x + 1)) - 1) {
    chmin(mn, bit[x]);
  }
  return mn;
}

int N;
Tuple!(int, "a", int, "b", int, "c", int, "id")[] P;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      P.length = N;
      foreach (i; 0 .. N) {
        P[i].a = readInt();
        P[i].b = readInt();
        P[i].c = readInt();
        P[i].id = i;
      }
      
      foreach (i; 0 .. N) {
        P[i].a = LIM - P[i].a;
        P[i].b = LIM - P[i].b;
        P[i].c = LIM - P[i].c;
      }
      P.sort;
      
      auto ans = new bool[N];
      bit = new int[LIM + 1];
      bit[] = LIM + 1;
      for (int j = 0, k; j < N; j = k) {
        for (k = j; k < N && P[j].a == P[k].a; ++k) {}
        debug {
          writeln(P[j .. k]);
        }
        foreach (p; P[j .. k]) {
          if (rangeMin(p.b + 1) <= p.c) {
            debug {
              writeln("found(a) ", p);
            }
            ans[p.id] = true;
          }
        }
        foreach (p; P[j .. k]) {
          update(p.b, p.c);
        }
        foreach (p; P[j .. k]) {
          if (rangeMin(p.b) <= p.c) {
            debug {
              writeln("found(b) ", p);
            }
            ans[p.id] = true;
          }
          if (rangeMin(p.b + 1) < p.c) {
            debug {
              writeln("found(c) ", p);
            }
            ans[p.id] = true;
          }
        }
      }
      foreach (i; 0 .. N) {
        if (!ans[i]) {
          writeln(i + 1);
        }
      }
    }
  } catch (EOFException e) {
  }
}
0