Submission #3009565
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 = ulong.Parse(line[1]); var wd = new ulong[n, 2]; var maxa = 0ul; for (int i = 0; i < n; i++) { line = Console.ReadLine().Trim().Split(' '); wd[i, 0] = ulong.Parse(line[0]); wd[i, 1] = ulong.Parse(line[1]); maxa = Math.Max(maxa, wd[i, 0] + (k - 1) * wd[i, 1] + 100L); } Console.WriteLine(getAns(wd, k, maxa)); } public static ulong getAns(ulong[,] wd, ulong k, ulong maxa) { var ok = maxa; var ng = 0ul; while (ok - ng > 1) { var mid = (ok + ng) / 2ul; if (getFLower(wd, mid, k)) ok = mid; else ng = mid; } return ok; } public static bool getFLower(ulong[,] wd, ulong a, ulong k) { var n = wd.GetLength(0); ulong f = 0; for (int i = 0; i < n; i++) f += (ulong)(a - wd[i, 0]) /(ulong) wd[i, 1] + 1; return f >=(ulong) k; } }
Submission Info
Submission Time | |
---|---|
Task | C - Garden |
User | bluemegane |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 1201 Byte |
Status | WA |
Exec Time | 228 ms |
Memory | 17300 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||||
Status |
|
|
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 | 23 ms | 11220 KB |
a02 | AC | 22 ms | 11092 KB |
a03 | WA | 22 ms | 11092 KB |
b04 | AC | 22 ms | 11092 KB |
b05 | WA | 228 ms | 15248 KB |
b06 | WA | 212 ms | 16572 KB |
b07 | WA | 223 ms | 14520 KB |
b08 | WA | 225 ms | 16568 KB |
b09 | WA | 223 ms | 16568 KB |
b10 | WA | 223 ms | 14520 KB |
b11 | WA | 227 ms | 16568 KB |
b12 | WA | 223 ms | 17300 KB |
b13 | WA | 220 ms | 14524 KB |
b14 | WA | 219 ms | 14524 KB |
b15 | WA | 227 ms | 16568 KB |
b16 | WA | 224 ms | 16572 KB |
b17 | WA | 220 ms | 16572 KB |
b18 | WA | 219 ms | 14524 KB |
b19 | WA | 215 ms | 16572 KB |
b20 | WA | 217 ms | 14524 KB |
b21 | WA | 216 ms | 15252 KB |
b22 | WA | 220 ms | 17300 KB |
b23 | WA | 218 ms | 16572 KB |