Submission #1157280
Source Code Expand
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ Array.Sort(A); long[] B = new long[N]; B[0] = A[0]; for(int i=1;i<N;i++){ B[i] = A[i] + B[i-1]; } int ans = 1; for(int i=N-2;i>=0;i--){ if(B[i] * 2 < A[i+1]) break; ans++; } Console.WriteLine(ans); } int N; long[] A; public Sol(){ N = ri(); A = rla(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | kuuso |
Language | C# (Mono 4.6.2.0) |
Score | 400 |
Code Size | 1188 Byte |
Status | AC |
Exec Time | 83 ms |
Memory | 26460 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 | 83 ms | 21856 KB |
in10.txt | AC | 43 ms | 12128 KB |
in11.txt | AC | 78 ms | 18912 KB |
in12.txt | AC | 78 ms | 26460 KB |
in13.txt | AC | 78 ms | 24412 KB |
in2.txt | AC | 82 ms | 17760 KB |
in3.txt | AC | 83 ms | 19808 KB |
in4.txt | AC | 82 ms | 17760 KB |
in5.txt | AC | 45 ms | 13664 KB |
in6.txt | AC | 72 ms | 18016 KB |
in7.txt | AC | 83 ms | 19680 KB |
in8.txt | AC | 72 ms | 18016 KB |
in9.txt | AC | 29 ms | 12384 KB |
sample1.txt | AC | 22 ms | 11348 KB |
sample2.txt | AC | 22 ms | 11220 KB |
sample3.txt | AC | 22 ms | 11348 KB |