Submission #1242781
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 n = cin.NextInt(); var k = cin.NextInt(); var a = new long[n]; for (var i = 0; i < n; i++) { a[i] = cin.NextInt(); } Array.Sort(a); var sum = a.Sum(); if (sum < k) { Console.WriteLine(n); return; } for (var i = n - 2; ; i--) { if (a[i] + a[i + 1] < k) { Console.WriteLine(i + 1); return; } } } 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 | D - No Need |
User | Neverauskas |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 2357 Byte |
Status | RE |
Exec Time | 27 ms |
Memory | 13780 KB |
Judge Result
Set Name | Sample | Subtask | All | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | 0 / 300 | ||||||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
Subtask | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 2_026.txt, 2_027.txt, 2_028.txt, 2_029.txt, 2_030.txt, 2_031.txt, 2_032.txt, 2_033.txt, 2_034.txt, 2_035.txt, 2_036.txt, 2_037.txt, 2_038.txt, 2_039.txt, 2_040.txt, 2_041.txt, 2_042.txt, 2_043.txt, 2_044.txt, 2_045.txt, 2_046.txt, 2_047.txt, 2_048.txt, 2_049.txt, 2_050.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 25 ms | 11348 KB |
0_001.txt | AC | 25 ms | 13396 KB |
0_002.txt | AC | 24 ms | 11348 KB |
1_003.txt | RE | 23 ms | 10848 KB |
1_004.txt | RE | 22 ms | 8800 KB |
1_005.txt | RE | 23 ms | 10848 KB |
1_006.txt | AC | 24 ms | 11348 KB |
1_007.txt | WA | 24 ms | 11348 KB |
1_008.txt | WA | 25 ms | 11348 KB |
1_009.txt | AC | 24 ms | 9300 KB |
1_010.txt | RE | 23 ms | 10976 KB |
1_011.txt | RE | 23 ms | 10976 KB |
1_012.txt | RE | 23 ms | 10848 KB |
1_013.txt | RE | 23 ms | 8800 KB |
1_014.txt | RE | 23 ms | 10848 KB |
1_015.txt | WA | 24 ms | 11348 KB |
1_016.txt | AC | 25 ms | 13396 KB |
1_017.txt | WA | 24 ms | 11348 KB |
1_018.txt | AC | 24 ms | 9300 KB |
1_019.txt | WA | 25 ms | 11348 KB |
1_020.txt | WA | 24 ms | 11348 KB |
1_021.txt | WA | 24 ms | 11348 KB |
1_022.txt | WA | 25 ms | 13396 KB |
1_023.txt | WA | 24 ms | 9300 KB |
1_024.txt | WA | 25 ms | 13396 KB |
1_025.txt | WA | 24 ms | 9300 KB |
2_026.txt | RE | 23 ms | 10848 KB |
2_027.txt | WA | 24 ms | 9300 KB |
2_028.txt | WA | 24 ms | 11348 KB |
2_029.txt | WA | 26 ms | 11604 KB |
2_030.txt | AC | 26 ms | 9684 KB |
2_031.txt | RE | 26 ms | 13408 KB |
2_032.txt | RE | 26 ms | 11360 KB |
2_033.txt | RE | 25 ms | 11232 KB |
2_034.txt | RE | 25 ms | 11232 KB |
2_035.txt | RE | 25 ms | 11232 KB |
2_036.txt | WA | 27 ms | 13780 KB |
2_037.txt | AC | 25 ms | 13396 KB |
2_038.txt | WA | 24 ms | 11348 KB |
2_039.txt | AC | 24 ms | 11348 KB |
2_040.txt | WA | 26 ms | 9684 KB |
2_041.txt | WA | 26 ms | 9684 KB |
2_042.txt | WA | 27 ms | 9684 KB |
2_043.txt | WA | 25 ms | 9556 KB |
2_044.txt | WA | 27 ms | 13652 KB |
2_045.txt | WA | 27 ms | 11604 KB |
2_046.txt | WA | 26 ms | 9556 KB |
2_047.txt | WA | 26 ms | 9556 KB |
2_048.txt | WA | 26 ms | 9684 KB |
2_049.txt | WA | 26 ms | 9556 KB |
2_050.txt | WA | 26 ms | 9556 KB |