Submission #3009504


Source Code Expand

using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = long.Parse(line[1]);
        var wd = new long[n, 2];
        var maxa = 0L;
        for (int i = 0; i < n; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            wd[i, 0] = long.Parse(line[0]);
            wd[i, 1] = long.Parse(line[1]);
            maxa = Math.Max(maxa, wd[i, 0] + k * wd[i, 1] + 100L);
        }
        Console.WriteLine(getAns(wd, k, maxa));
    }
    public static long getAns(long[,] wd, long k, long maxa)
    {
        var ok = maxa;
        var ng = 0L;
        while (ok - ng > 1)
        {
            var mid = (ok + ng) / 2L;
            if (getFLower(wd, mid, k)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
    public static bool getFLower(long[,] wd, long a, long k)
    {
        var n = wd.GetLength(0);
        var f = 0L;
        for (int i = 0; i < n; i++)
            f += (a - wd[i, 0]) / wd[i, 1] + 1;
        return f >= k;
    }
}

Submission Info

Submission Time
Task C - Garden
User bluemegane
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1159 Byte
Status WA
Exec Time 252 ms
Memory 17296 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 3
AC × 10
WA × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23
Case Name Status Exec Time Memory
a01 AC 22 ms 9172 KB
a02 AC 22 ms 11092 KB
a03 AC 21 ms 11092 KB
b04 AC 21 ms 11092 KB
b05 AC 247 ms 16568 KB
b06 AC 230 ms 14524 KB
b07 AC 241 ms 16568 KB
b08 AC 242 ms 17296 KB
b09 AC 243 ms 16568 KB
b10 AC 243 ms 16568 KB
b11 WA 248 ms 16568 KB
b12 WA 238 ms 14524 KB
b13 WA 238 ms 16572 KB
b14 WA 252 ms 14524 KB
b15 WA 247 ms 14520 KB
b16 WA 241 ms 16572 KB
b17 WA 236 ms 14524 KB
b18 WA 238 ms 16572 KB
b19 WA 237 ms 14524 KB
b20 WA 234 ms 16572 KB
b21 WA 235 ms 16572 KB
b22 WA 235 ms 14524 KB
b23 WA 235 ms 16572 KB