Submission #1370323
Source Code Expand
#include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <string> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <climits> #include <cstring> #include <cstdlib> #include <fstream> #include <numeric> #include <sstream> #include <cassert> #include <iomanip> #include <iostream> #include <algorithm> #include <unordered_set> #include <unordered_map> using namespace std; #define f first #define s second #define pb push_back #define pp pop_back #define mp make_pair #define ll long long #define ld double #define ull unsigned long long #define PI pair < int, int > const int N = 5e5 + 123; const int M = 123; const ld Pi = acos(-1); const ll Inf = 1e18; const int inf = 1e9; const int mod = 1e9 + 7; const int Sz = 501; const int MOD = 1e9 + 7; void add(int &a, int b) { a += b; if (a >= mod) a -= mod; } int mult(int a, int b) { return 1ll * a * b % mod; } int sum(int a, int b) { add(a, b); return a; } int n, a[N], ans; void solve() { cin >> n; for (int i = 1;i <= n;i++) { cin >> a[i]; } for (int i = 1;i <= n;i++) { vector < int > now; for (int j = 1;j <= n;j++) { if (i != j) now.pb(a[j]); } sort(now.begin(), now.end()); ll cur = a[i]; bool fail = 0; for (auto j : now) { if (j > cur * 2) fail = 1; else { cur += j; } } if (!fail) ans++; } cout << ans << endl; } int main() { #ifdef wws freopen("in", "r", stdin); // freopen("in", "w", stdout); #endif ios_base::sync_with_stdio(0); int tt = 1; while(tt--) solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Colorful Creatures |
User | SmallBoy |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1766 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 1624 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 | TLE | 2103 ms | 1624 KB |
in10.txt | TLE | 2103 ms | 904 KB |
in11.txt | TLE | 2103 ms | 1620 KB |
in12.txt | TLE | 2103 ms | 1624 KB |
in13.txt | TLE | 2103 ms | 1620 KB |
in2.txt | TLE | 2103 ms | 1624 KB |
in3.txt | TLE | 2103 ms | 1620 KB |
in4.txt | TLE | 2103 ms | 1624 KB |
in5.txt | TLE | 2103 ms | 888 KB |
in6.txt | TLE | 2103 ms | 1620 KB |
in7.txt | TLE | 2103 ms | 1620 KB |
in8.txt | TLE | 2103 ms | 1612 KB |
in9.txt | TLE | 2103 ms | 384 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |