Submission #1156776


Source Code Expand

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<vector<ll> > mat;

ll n,a[100005],s=0;

int main()
{ios_base::sync_with_stdio(false);
cin>>n;
rep(i,0,n-1)cin>>a[i];
sort(a,a+n);
int ans=n;
rep(i,0,n-2)
{
	s+=a[i];
	if(a[i+1]>s*2)
	ans=n-i-1;
}
ol(ans);
return 0;
}

Submission Info

Submission Time
Task B - Colorful Creatures
User abisheka
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1541 Byte
Status AC
Exec Time 18 ms
Memory 1024 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 18 ms 1024 KB
in10.txt AC 7 ms 640 KB
in11.txt AC 17 ms 1024 KB
in12.txt AC 13 ms 1024 KB
in13.txt AC 13 ms 1024 KB
in2.txt AC 18 ms 1024 KB
in3.txt AC 18 ms 1024 KB
in4.txt AC 18 ms 1024 KB
in5.txt AC 7 ms 512 KB
in6.txt AC 15 ms 1024 KB
in7.txt AC 17 ms 1024 KB
in8.txt AC 15 ms 1024 KB
in9.txt AC 3 ms 384 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB