Submission #1242765
Source Code Expand
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; namespace Codeforces { internal class Template { private void Solve() { var w = cin.NextInt(); var a = cin.NextInt(); var b = cin.NextInt(); var aa = a + w; var bb = b + w; if (a <= bb & b <= aa) { Console.WriteLine(0); return; } Console.WriteLine(a - bb > 0 ? a - bb : b - aa); } private static readonly Scanner cin = new Scanner(); private static void Main() { #if DEBUG var inputText = File.ReadAllText(@"..\..\input.txt"); var testCases = inputText.Split(new[] { "input" }, StringSplitOptions.RemoveEmptyEntries); var consoleOut = Console.Out; for (var i = 0; i < testCases.Length; i++) { var parts = testCases[i].Split(new[] { "output" }, StringSplitOptions.RemoveEmptyEntries); Console.SetIn(new StringReader(parts[0].Trim())); var stringWriter = new StringWriter(); Console.SetOut(stringWriter); var sw = Stopwatch.StartNew(); new Template().Solve(); sw.Stop(); var output = stringWriter.ToString(); Console.SetOut(consoleOut); var color = ConsoleColor.Green; var status = "Passed"; if (parts[1].Trim() != output.Trim()) { color = ConsoleColor.Red; status = "Failed"; } Console.ForegroundColor = color; Console.WriteLine("Test {0} {1} in {2}ms", i + 1, status, sw.ElapsedMilliseconds); } Console.ReadLine(); Console.ReadKey(); #else new Template().Solve(); Console.ReadLine(); #endif } } internal class Scanner { private string[] s = new string[0]; private int i; private readonly char[] cs = { ' ' }; public string NextString() { if (i < s.Length) return s[i++]; var line = Console.ReadLine() ?? string.Empty; s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 1; return s.First(); } public double NextDouble() { return double.Parse(NextString()); } public int NextInt() { return int.Parse(NextString()); } public long NextLong() { return long.Parse(NextString()); } } }
Submission Info
Submission Time | |
---|---|
Task | B - NarrowRectanglesEasy |
User | Neverauskas |
Language | C# (Mono 4.6.2.0) |
Score | 200 |
Code Size | 2216 Byte |
Status | AC |
Exec Time | 23 ms |
Memory | 13268 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 23 ms | 13268 KB |
0_001.txt | AC | 22 ms | 9172 KB |
0_002.txt | AC | 22 ms | 11220 KB |
0_003.txt | AC | 22 ms | 9172 KB |
1_004.txt | AC | 22 ms | 9172 KB |
1_005.txt | AC | 22 ms | 11220 KB |
1_006.txt | AC | 23 ms | 13268 KB |
1_007.txt | AC | 22 ms | 11220 KB |
1_008.txt | AC | 22 ms | 9172 KB |
1_009.txt | AC | 22 ms | 9172 KB |