Submission #20534945


Source Code Expand

Copy
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, 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)); }




void main() {
  try {
    for (; ; ) {
      const N = readInt();
      auto A = new long[N];
      auto P = new long[N];
      auto X = new long[N];
      foreach (i; 0 .. N) {
        A[i] = readLong();
        P[i] = readLong();
        X[i] = readLong();
      }
      
      long ans = long.max;
      foreach (i; 0 .. N) {
        if (X[i] - A[i] > 0) {
          chmin(ans, P[i]);
        }
      }
      writeln((ans >= long.max) ? -1 : ans);
    }
  } catch (EOFException e) {
  }
}

Submission Info

Submission Time
Task B - Play Snuke
User hos_lyric
Language D (LDC 1.20.1)
Score 200
Code Size 1711 Byte
Status AC
Exec Time 72 ms
Memory 13608 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 18
Set Name Test Cases
Sample 01_sample.txt, 02_sample.txt, 03_sample.txt
All 01_sample.txt, 02_sample.txt, 03_sample.txt, 04_small.txt, 05_small.txt, 06_small.txt, 07_small.txt, 08_small.txt, 09_large.txt, 10_large.txt, 11_large.txt, 12_large.txt, 13_large.txt, 14_ng.txt, 15_ng.txt, 16_max.txt, 17_max.txt, 18_max.txt
Case Name Status Exec Time Memory
01_sample.txt AC 9 ms 3292 KB
02_sample.txt AC 3 ms 3104 KB
03_sample.txt AC 3 ms 3232 KB
04_small.txt AC 4 ms 3220 KB
05_small.txt AC 3 ms 3224 KB
06_small.txt AC 3 ms 3104 KB
07_small.txt AC 3 ms 3348 KB
08_small.txt AC 3 ms 3108 KB
09_large.txt AC 33 ms 4748 KB
10_large.txt AC 43 ms 5168 KB
11_large.txt AC 33 ms 4992 KB
12_large.txt AC 39 ms 4920 KB
13_large.txt AC 28 ms 4392 KB
14_ng.txt AC 5 ms 3596 KB
15_ng.txt AC 36 ms 4924 KB
16_max.txt AC 64 ms 6200 KB
17_max.txt AC 66 ms 6356 KB
18_max.txt AC 72 ms 13608 KB