Submission #1675873
Source Code Expand
#include "bits/stdc++.h"
using namespace std;
using VS = vector<string>; using LL = long long;
using VI = vector<int>; using VVI = vector<VI>;
using PII = pair<int, int>; using PLL = pair<LL, LL>;
using VL = vector<LL>; using VVL = vector<VL>;
#define ALL(a) begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9; const LL LINF = 1e16;
const LL MOD = 1000000007; const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 }; int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
/* ----- 2017/10/11 Problem: N18_b / Link: ----- */
/* ------問題------
-----問題ここまで----- */
/* -----解説等-----
----解説ここまで---- */
LL N;
LL ans = 0LL;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cin >> N;
VI a(N,0);
FOR(i, 0, N)cin >> a[i];
SORT(a);
VI sum(N + 1,0);
sum[0] = 0;
FOR(i, 1, N+1) {
sum[i] = sum[i - 1] + a[i-1];
}
ans = 1;
FORR(i, N, 1) {
if (a[i-1] <= 2 * sum[i - 1])ans++;
}
cout << ans << "\n";
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Colorful Creatures |
User |
Yang33 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1516 Byte |
Status |
WA |
Exec Time |
19 ms |
Memory |
1024 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 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 |
WA |
19 ms |
1024 KB |
in10.txt |
WA |
8 ms |
640 KB |
in11.txt |
WA |
17 ms |
1024 KB |
in12.txt |
WA |
14 ms |
1024 KB |
in13.txt |
WA |
14 ms |
1024 KB |
in2.txt |
WA |
18 ms |
1024 KB |
in3.txt |
WA |
18 ms |
1024 KB |
in4.txt |
WA |
18 ms |
1024 KB |
in5.txt |
WA |
8 ms |
512 KB |
in6.txt |
WA |
15 ms |
1024 KB |
in7.txt |
WA |
18 ms |
1024 KB |
in8.txt |
WA |
15 ms |
1024 KB |
in9.txt |
WA |
3 ms |
384 KB |
sample1.txt |
AC |
1 ms |
256 KB |
sample2.txt |
AC |
1 ms |
256 KB |
sample3.txt |
WA |
1 ms |
256 KB |