Submission #1157448
Source Code Expand
Copy
# -*- coding: utf-8 -*- import math,string,itertools,fractions,heapq,collections,re,array,bisect def s(): return raw_input().strip() def n(): return int(raw_input()) def d(): return float(raw_input()) def ls(): return raw_input().strip().split() def ln(): return map(int, raw_input().strip().split()) def ld(): return map(float, raw_input().strip().split()) def fs(): return [raw_input().strip() for i in xrange(input())] def fn(): return [int(raw_input().strip()) for i in xrange(input())] def fd(): return [float(raw_input().strip()) for i in xrange(input())] EPS = 1e-9 #http://www.deqnotes.net/acmicpc/2d_geometry/lines def dot(a, b): return a.real * b.real + a.imag * b.imag def cross(a, b): return a.real * b.imag - a.imag * b.real def distance(a, b, c): if dot(b-a, c-a) <= EPS: return abs(c-a) if dot(a-b, c-b) <= EPS: return abs(c-b) return abs(cross(b-a, c-a)/(b-a)) N = n() A = ln() A.sort() cum = [A[0]] for a in A[1:]: cum.append(cum[-1] + a) #print cum #for i, a in enumerate(A): # print i, a x2 = len(A) - 1 result = 1 for i in xrange(len(A) - 2, -1, -1): #while A[x2] > 2 * A[i] and x2 > 0: # x2 -= 1 #cum[x2] - A[i] if cum[i] * 2 < A[i + 1]: break result += 1 print result
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | mugenen |
Language | PyPy2 (5.6.0) |
Score | 400 |
Code Size | 1384 Byte |
Status | AC |
Exec Time | 687 ms |
Memory | 48204 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 | 687 ms | 48204 KB |
in10.txt | AC | 77 ms | 37220 KB |
in11.txt | AC | 99 ms | 46260 KB |
in12.txt | AC | 89 ms | 46324 KB |
in13.txt | AC | 89 ms | 46076 KB |
in2.txt | AC | 100 ms | 46548 KB |
in3.txt | AC | 100 ms | 46668 KB |
in4.txt | AC | 102 ms | 46540 KB |
in5.txt | AC | 77 ms | 36964 KB |
in6.txt | AC | 96 ms | 45904 KB |
in7.txt | AC | 101 ms | 46588 KB |
in8.txt | AC | 95 ms | 45772 KB |
in9.txt | AC | 63 ms | 33384 KB |
sample1.txt | AC | 56 ms | 33256 KB |
sample2.txt | AC | 56 ms | 33128 KB |
sample3.txt | AC | 57 ms | 33256 KB |