Submission #1421216
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define con continue #define bk break #define LL long long #define db double #define pt cout<<'\n' #define ms(a, b) memset((a), (b), sizeof(a)) #define mp make_pair #define endl '\n' int inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =223372036854775807; #define sz size() #define len(X) strlen(X) #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define ULL unsigned long long #define de cout<<"test"<<endl; #define st system("pause"); #define M_PI 3.1415926 LL A[100005]={}; int main() { int a; while(cin>>a){ for(int i=0;i<a;i++){ cin>>A[i]; } sort(A,A+a); int ans=a; LL now=0; int l=0; for(int r=0;r<a-1;r++){ now+=A[r]; if(now*2<A[r+1]){ ans-=(r-l+1); l=r+1; } } cout<<ans<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | ga544523 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 940 Byte |
Status | AC |
Exec Time | 46 ms |
Memory | 1024 KB |
Compile Error
./Main.cpp:18:0: warning: "M_PI" redefined #define M_PI 3.1415926 ^ In file included from /usr/include/c++/5/cmath:44:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:41, from ./Main.cpp:1: /usr/include/math.h:372:0: note: this is the location of the previous definition # define M_PI 3.14159265358979323846 /* pi */ ^
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 | 46 ms | 1024 KB |
in10.txt | AC | 15 ms | 512 KB |
in11.txt | AC | 39 ms | 1024 KB |
in12.txt | AC | 44 ms | 1024 KB |
in13.txt | AC | 44 ms | 1024 KB |
in2.txt | AC | 46 ms | 1024 KB |
in3.txt | AC | 46 ms | 1024 KB |
in4.txt | AC | 46 ms | 1024 KB |
in5.txt | AC | 18 ms | 512 KB |
in6.txt | AC | 33 ms | 1024 KB |
in7.txt | AC | 45 ms | 1024 KB |
in8.txt | AC | 32 ms | 1024 KB |
in9.txt | AC | 7 ms | 384 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |