Submission #1305135
Source Code Expand
#include <cstdio> #include <algorithm> int main(){ int N,i,i2; scanf("%d",&N); long long A[100000],large; for(i=0;i<N;i++){ scanf("%lld",&A[i]); } std::sort(A,A+N); int color_num=1; for(i=0;i<N;i++){ large=A[i]; for(i2=0;i2<N;i2++){ if(i==i2)continue; if(large*2<A[i2]){ i=i2-1; break; } if(i2==N-1)color_num++; large=large+A[i2]; } } printf("%d",color_num); }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | stream |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 431 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 896 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:6:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld",&A[i]); ^
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 | TLE | 2103 ms | 896 KB |
in10.txt | AC | 464 ms | 512 KB |
in11.txt | TLE | 2103 ms | 896 KB |
in12.txt | TLE | 2103 ms | 896 KB |
in13.txt | TLE | 2103 ms | 896 KB |
in2.txt | TLE | 2103 ms | 896 KB |
in3.txt | TLE | 2103 ms | 896 KB |
in4.txt | TLE | 2103 ms | 896 KB |
in5.txt | AC | 1800 ms | 512 KB |
in6.txt | AC | 1330 ms | 896 KB |
in7.txt | TLE | 2103 ms | 896 KB |
in8.txt | AC | 1525 ms | 896 KB |
in9.txt | AC | 178 ms | 256 KB |
sample1.txt | AC | 1 ms | 128 KB |
sample2.txt | AC | 1 ms | 128 KB |
sample3.txt | AC | 1 ms | 128 KB |