Submission #1268935
Source Code Expand
#include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> using namespace std; const int INF = 0x7777777; 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); /*for(int d = 0;d<n;d++){ cout<<s[d]<<endl; }*/ 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++){ /*if(ans*2>s[k]||ans*2==s[k]){ ans += s[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 | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 878 Byte |
Status | RE |
Exec Time | 4 ms |
Memory | 584 KB |
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 | 4 ms | 584 KB |
in10.txt | RE | 4 ms | 584 KB |
in11.txt | RE | 4 ms | 580 KB |
in12.txt | RE | 4 ms | 584 KB |
in13.txt | RE | 4 ms | 572 KB |
in2.txt | RE | 4 ms | 576 KB |
in3.txt | RE | 4 ms | 584 KB |
in4.txt | RE | 4 ms | 584 KB |
in5.txt | RE | 4 ms | 576 KB |
in6.txt | RE | 4 ms | 576 KB |
in7.txt | RE | 4 ms | 572 KB |
in8.txt | RE | 4 ms | 580 KB |
in9.txt | RE | 4 ms | 576 KB |
sample1.txt | RE | 4 ms | 576 KB |
sample2.txt | RE | 4 ms | 576 KB |
sample3.txt | RE | 4 ms | 576 KB |