Submission #1157579
Source Code Expand
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; class Prog { public Prog() { } public static int Main() { new Prog().calc(); return 0; } Scanner cin; public void calc() { cin = new Scanner(); long N = cin.nextLong(); long[] A = new long[N]; for (long i = 0; i < N; i++) A[i] = cin.nextLong(); Array.Sort(A); long cumsum = 0; long ans = 0; for(long i = 0;i<N-1; i++) { cumsum += A[i]; if (A[i + 1] > 2 * cumsum) ans = 0; else ans++; } ans++; Console.WriteLine(ans); Console.Read(); } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return s[i++]; } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | misora192 |
Language | C# (Mono 4.6.2.0) |
Score | 400 |
Code Size | 1505 Byte |
Status | AC |
Exec Time | 84 ms |
Memory | 31708 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 84 ms | 19040 KB |
in10.txt | AC | 44 ms | 11744 KB |
in11.txt | AC | 79 ms | 18016 KB |
in12.txt | AC | 80 ms | 31708 KB |
in13.txt | AC | 80 ms | 23516 KB |
in2.txt | AC | 84 ms | 21088 KB |
in3.txt | AC | 84 ms | 21088 KB |
in4.txt | AC | 84 ms | 21088 KB |
in5.txt | AC | 45 ms | 13408 KB |
in6.txt | AC | 73 ms | 18912 KB |
in7.txt | AC | 82 ms | 16864 KB |
in8.txt | AC | 72 ms | 17248 KB |
in9.txt | AC | 29 ms | 11352 KB |
sample1.txt | AC | 23 ms | 13268 KB |
sample2.txt | AC | 22 ms | 9172 KB |
sample3.txt | AC | 22 ms | 9172 KB |