Submission #1306847


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        int N = cin.Nextint;
        int now = 0;
   
        var A = cin.Scanlong;
        Array.Sort(A);
        long cnt = A[0];
        for (int i = 1; i < N; i++)
        {
            if(2 * cnt < A[i])
            {
                now = i;
            }
            cnt += A[i];
        }
        WriteLine(N - now);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Submission Info

Submission Time
Task B - Colorful Creatures
User claw88
Language C# (Mono 4.6.2.0)
Score 400
Code Size 2043 Byte
Status AC
Exec Time 88 ms
Memory 27736 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 19
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 88 ms 17116 KB
in10.txt AC 47 ms 15964 KB
in11.txt AC 83 ms 20060 KB
in12.txt AC 84 ms 27736 KB
in13.txt AC 84 ms 25688 KB
in2.txt AC 88 ms 19164 KB
in3.txt AC 88 ms 17116 KB
in4.txt AC 88 ms 19164 KB
in5.txt AC 48 ms 13532 KB
in6.txt AC 76 ms 16988 KB
in7.txt AC 87 ms 19036 KB
in8.txt AC 75 ms 17372 KB
in9.txt AC 32 ms 12380 KB
sample1.txt AC 24 ms 11344 KB
sample2.txt AC 24 ms 9424 KB
sample3.txt AC 24 ms 11344 KB