Submission #1268939
Source Code Expand
#include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> using namespace std; const int MOD = 1e4+7; int s[MOD]; int n; bool cmp(int x,int y){ return x>y; } int main(){ while(scanf("%d",&n)){ int i; for(i=0;i<n;i++){ scanf("%d",&s[i]); } sort(s,s+i,cmp); long long sum = 1; for(int j=1;j<n;j++){ int q = 1; long long ans = s[j]; for(int k=j+1;k<n;k++){ ans+=s[k]; if(ans*2 > s[0] || ans*2==s[0]){ sum++; q = 0; break; } } if(q==0) continue; for(int o=j-1;o>0;o--){ if(s[o]<ans*2 || s[o]==ans*2){ ans+=s[o]; } if(ans*2>s[0] || ans*2 == s[0]){ sum++; break; } } } printf("%d\n",sum); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | vjudge1 |
Language | C++14 (Clang 3.8.0) |
Score | 0 |
Code Size | 735 Byte |
Status | RE |
Exec Time | 2103 ms |
Memory | 2816 KB |
Compile Error
./Main.cpp:42:17: warning: format specifies type 'int' but the argument has type 'long long' [-Wformat] printf("%d\n",sum); ~~ ^~~ %lld 1 warning generated.
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 | RE | 97 ms | 256 KB |
in10.txt | RE | 98 ms | 256 KB |
in11.txt | RE | 97 ms | 256 KB |
in12.txt | RE | 98 ms | 256 KB |
in13.txt | RE | 97 ms | 256 KB |
in2.txt | RE | 97 ms | 256 KB |
in3.txt | RE | 100 ms | 256 KB |
in4.txt | RE | 99 ms | 256 KB |
in5.txt | RE | 98 ms | 256 KB |
in6.txt | TLE | 2103 ms | 256 KB |
in7.txt | RE | 97 ms | 256 KB |
in8.txt | TLE | 2103 ms | 256 KB |
in9.txt | RE | 97 ms | 256 KB |
sample1.txt | TLE | 2103 ms | 2816 KB |
sample2.txt | TLE | 2103 ms | 2048 KB |
sample3.txt | TLE | 2103 ms | 1792 KB |