Submission #2857031
Source Code Expand
#include<bits/stdc++.h> #include<numeric> const int INF = 1e9; const int MOD = 1e9+7; using LL = long long; const LL LINF = 1e18; using namespace std; #define COUT(v) cout<<(v)<<endl #define CIN(n) int(n);cin >> (n) #define LCIN(n) LL(n);cin >> (n) #define SCIN(n) string(n);cin >> (n) #define YES(n) cout<<((n)? "YES" : "NO")<<endl #define Yes(n) cout<<((n)? "Yes" : "No")<<endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) <<endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define ALL(obj) (obj).begin(),(obj).end() #define P pair<LL,LL> #define I vector<int> #define S set<int> #define pb(v) push_back(v) #define V vector #define rt return #define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end()) typedef string::const_iterator State; class PalseError {}; class Edge{ public: LL from,to,value; Edge(LL a,LL b,LL c){ from = a; to = b; value = c; } Edge(LL a,LL b){ from = a; to = b; } }; int main(){ CIN(N); V<LL> vec; REP(a,N){ LCIN(b); vec.pb(b); } sort(ALL(vec)); LL ruiseki[1000000]; ruiseki[0]=0; REP(a,N){ ruiseki[a+1]=ruiseki[a]+vec.at(a); } int a; int ins=0; for(a = N-1;a >= 0;a--){ // cout<<vec.at(a)<<" "<<ruiseki[a]*2<<endl; if(!(vec.at(a) <= ruiseki[a]*2)){ ins = N-a; break; } } COUT(ins); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | hamuhei4869 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1711 Byte |
Status | AC |
Exec Time | 48 ms |
Memory | 3956 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 | 47 ms | 1908 KB |
in10.txt | AC | 16 ms | 1016 KB |
in11.txt | AC | 40 ms | 3828 KB |
in12.txt | AC | 46 ms | 1908 KB |
in13.txt | AC | 46 ms | 1908 KB |
in2.txt | AC | 48 ms | 3700 KB |
in3.txt | AC | 48 ms | 3188 KB |
in4.txt | AC | 47 ms | 1908 KB |
in5.txt | AC | 19 ms | 1016 KB |
in6.txt | AC | 34 ms | 3956 KB |
in7.txt | AC | 47 ms | 1908 KB |
in8.txt | AC | 33 ms | 1908 KB |
in9.txt | AC | 7 ms | 512 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |