Submission #1156763


Source Code Expand

#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
signed main()
{
    Int(n);
    vi data(n);

    rep(i, n) {
        cin >> data[i];
    }

    sort(all(data));

    int sum = data[0], ans = 0;

    data.pb(-1);

    Rep(i, n + 1) {
        if (sum * 2 >= data[i]) {
            ans++;
        } else {
            ans = 0;
        }
        sum += data[i];
    }

    cout << ans << endl;





    return 0;
}

Submission Info

Submission Time
Task B - Colorful Creatures
User Ti11192916
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1110 Byte
Status AC
Exec Time 48 ms
Memory 1792 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:22:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define Int(x) int x; scanf("%lld", &x);
                                        ^
./Main.cpp:30:5: note: in expansion of macro ‘Int’
     Int(n);
     ^

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 48 ms 1792 KB
in10.txt AC 16 ms 896 KB
in11.txt AC 40 ms 1792 KB
in12.txt AC 46 ms 1792 KB
in13.txt AC 45 ms 1792 KB
in2.txt AC 47 ms 1792 KB
in3.txt AC 47 ms 1792 KB
in4.txt AC 47 ms 1792 KB
in5.txt AC 19 ms 896 KB
in6.txt AC 33 ms 1792 KB
in7.txt AC 46 ms 1792 KB
in8.txt AC 33 ms 1792 KB
in9.txt AC 6 ms 384 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB