Submission #2856949


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<P> vec;
    REP(a,N){
        CIN(b);
        vec.pb(make_pair(b,a+1));
    }
    sort(ALL(vec));
    LL ruiseki[1000000];
    ruiseki[0]=0;
    REP(a,N){
        ruiseki[a+1]=ruiseki[a]+vec.at(a).first;
    }
    int a;
    int ins=0;
    for(a = 0;a < N-1;a++){
        if(!(vec.at(a+1).first <= ruiseki[a+1]*2)){
            ins = a+1;
            break;
        }
    }
    COUT(N-ins);
    return 0;
}

Submission Info

Submission Time
Task B - Colorful Creatures
User hamuhei4869
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1688 Byte
Status WA
Exec Time 51 ms
Memory 4720 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 16
WA × 3
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 49 ms 2672 KB
in10.txt AC 17 ms 1400 KB
in11.txt AC 43 ms 4720 KB
in12.txt WA 51 ms 2672 KB
in13.txt AC 51 ms 2672 KB
in2.txt AC 49 ms 2672 KB
in3.txt AC 49 ms 2672 KB
in4.txt WA 50 ms 4080 KB
in5.txt AC 20 ms 1400 KB
in6.txt AC 38 ms 2672 KB
in7.txt WA 49 ms 4464 KB
in8.txt AC 37 ms 2672 KB
in9.txt AC 7 ms 640 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB