Submission #1371625
Source Code Expand
#include <iostream> #include <queue> #include <vector> using namespace std; typedef unsigned long long u64; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; priority_queue< u64, vector< u64 >, greater< u64 > > a; for (int i = 0; i < n; ++i) { u64 ai; cin >> ai; a.push(ai); } u64 weakest = a.top(); a.pop(); int cnt = 1; while (!a.empty()) { u64 next = a.top(); a.pop(); if (weakest * 2 < next) { cnt = 1; } else { cnt++; } weakest += next; } cout << cnt << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | knk |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 613 Byte |
Status | AC |
Exec Time | 23 ms |
Memory | 1400 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 | 23 ms | 1400 KB |
in10.txt | AC | 9 ms | 892 KB |
in11.txt | AC | 22 ms | 1400 KB |
in12.txt | AC | 15 ms | 1400 KB |
in13.txt | AC | 15 ms | 1400 KB |
in2.txt | AC | 23 ms | 1400 KB |
in3.txt | AC | 23 ms | 1400 KB |
in4.txt | AC | 23 ms | 1400 KB |
in5.txt | AC | 9 ms | 892 KB |
in6.txt | AC | 20 ms | 1400 KB |
in7.txt | AC | 22 ms | 1400 KB |
in8.txt | AC | 20 ms | 1400 KB |
in9.txt | AC | 4 ms | 512 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |