Submission #20881539


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)); }


enum L = 10L^^7;

void main() {
  try {
    for (; ; ) {
      const A = readLong();
      const B = readLong();
      const W = readLong() * 1000;
      
      long ansMin = L, ansMax = -1;
      foreach (k; 0 .. L) {
        if (A * k <= W && W <= B * k) {
          chmin(ansMin, k);
          chmax(ansMax, k);
        }
      }
      if (ansMin <= ansMax) {
        writeln(ansMin, " ", ansMax);
      } else {
        writeln("UNSATISFIABLE");
      }
    }
  } catch (EOFException e) {
  }
}

Submission Info

Submission Time
Task B - Many Oranges
User hos_lyric
Language D (LDC 1.20.1)
Score 200
Code Size 1715 Byte
Status AC
Exec Time 23 ms
Memory 3404 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 26
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
hand_01.txt AC 18 ms 3368 KB
hand_02.txt AC 16 ms 3376 KB
hand_03.txt AC 16 ms 3392 KB
hand_04.txt AC 19 ms 3380 KB
hand_05.txt AC 23 ms 3300 KB
hand_06.txt AC 19 ms 3112 KB
hand_07.txt AC 20 ms 3232 KB
random_01.txt AC 15 ms 3284 KB
random_02.txt AC 19 ms 3296 KB
random_03.txt AC 21 ms 3344 KB
random_04.txt AC 18 ms 3296 KB
random_05.txt AC 15 ms 3300 KB
random_06.txt AC 22 ms 3404 KB
random_07.txt AC 17 ms 3384 KB
random_08.txt AC 22 ms 3284 KB
random_09.txt AC 17 ms 3372 KB
random_10.txt AC 17 ms 3280 KB
random_11.txt AC 19 ms 3108 KB
random_12.txt AC 19 ms 3384 KB
random_13.txt AC 21 ms 3104 KB
random_14.txt AC 14 ms 3108 KB
random_15.txt AC 20 ms 3292 KB
random_16.txt AC 21 ms 3344 KB
sample_01.txt AC 21 ms 3384 KB
sample_02.txt AC 19 ms 3228 KB
sample_03.txt AC 17 ms 3296 KB